SyntaxHighlighter

2012年1月31日火曜日

【AndEngine】背景を画像にする


背景に画像を使いたい場合の方法。


onLoadResources()内で
背景テクスチャのTextureRegionクラスのインスタンスを生成

onLoadScene()内で
背景画像からSpriteのインスタンスを生成、
SpriteからSpriteBackgroundのインスタンスを生成してsetBackgroundメソッドに読み込ませてあげる。



■SpriteBackgroundクラスのコンストラクタ
SpriteBackground(final BaseSprite pBaseSprite)
SpriteBackground(final float pRed, final float pGreen, final float pBlue, final BaseSprite pBaseSprite)

■SceneクラスのsetBackgroundメソッド
void setBackground(final IBackground pBackground)

参考にしたソース

AndEngine-Forumsより
Set as a background image

では実際に使用した際から抜粋



/**  省略  **/

private BitmapTextureAtlas mBackgroundTextureAtlas;
private TextureRegion mBackgroundGrassTextureRegion;

public void onLoadResources() {
  BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
  this.mBackgroundTextureAtlas = new BitmapTextureAtlas(512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
  this.mBackgroundGrassTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBackgroundTextureAtlas, this, "bg1.png", 0, 0);
  this.mEngine.getTextureManager().loadTextures(this.mBackgroundTextureAtlas);
}
 
public Scene onLoadScene() {
  this.mEngine.registerUpdateHandler(new FPSLogger());
  this.mScene = new Scene();
  
  final Sprite sp = new Sprite(0, 0, mBackgroundGrassTextureRegion);
  this.mScene.setBackground(new SpriteBackground(sp));
  
  /** 省略 **/
  
  return this.mScene;
}








2012年1月18日水曜日

【AndEngine】TimerHandlerの使い方

タイマーを使用してn秒後に〇〇したい。という要望を叶える。

まずTimerHandlerクラスについてjavadocを見てみよう。
Class TimerHandler


コンストラクタは2つ
TimerHandler(float pTimerSeconds, boolean pAutoReset,
       ITimerCallback pTimerCallback)
TimerHandler(float pTimerSeconds, ITimerCallback pTimerCallback)

第一引数は秒で指定。
上の方は第二引数にboolean型でAutoResetの指定ができる。
メソッドのsetAutoReset(boolean pAutoReset) でも同様に設定できる。
AutoResetをtrueにすると指定した秒で繰り返しpTimerCallbackが呼ばれる。
falseの場合は指定した秒が経過するとpTimerCallbackが1度呼ばれる。
reset()を実行すると再度Timerが起動する。
引数のpTimerCallbackはITimerCallbackインターフェイスを実装した自身を呼ぶためにthisを指定したり、ITimerCallbackインターフェイスをnewしても良い。
では、サンプル

final TimerHandler timerHandler = new TimerHandler(1.0f, true, new ITimerCallback() {

  public void onTimePassed(TimerHandler pTimerHandler) {
  
    /** 処理したい内容を記述 **/
    Debug.d("TimePassed");
  }

});
mScene.registerUpdateHandler(timerHandler);
TimerHandlerのインスタンスをregisterUpdateHandlerに渡すことを忘れずに。

2012年1月15日日曜日

【AndEngine】TMX map を使った簡単な例 衝突判定

今回は衝突判定についてです。


以前から使っているDigitalOnScreenControlを使ってプレイヤーを移動させ、Sceneに描画した四角と衝突している間、色を変える例です。

使用している変数、DigitalOnScreenControl等は以前のコードを参考にして下さい。

final Rectangle exampleRectangle = new Rectangle(100, 100, 32, 32);  //四角を描画
exampleRectangle.setColor(0f, 0f, 1f);  //青
mScene.attachChild(exampleRectangle);

mScene.registerUpdateHandler(new IUpdateHandler(){

  public void onUpdate(float pSecondsElapsed) {
    //四角とplayerが衝突したか
    if(exampleRectangle.collidesWith(player)){
      exampleRectangle.setColor(1f, 0f, 0f);  //赤
    } else {
      exampleRectangle.setColor(0f, 0f, 1f);  //青
    }
  }

  public void reset() {
  }

});

実行結果は以下になります。
衝突前

衝突時

衝突前は青。衝突時は赤となるようにしました。

2012年1月13日金曜日

【AndEngine】TMX map を使った簡単な例 HUDを使う

HUDは、ヘッドアップディスプレイの略であり、ディスプレイ上の固定位置に配置されているユーザーインターフェースのすべての部分を表します。
以前紹介したDigitalOnScreenControlのように画面がスクロールしてもディスプレイ上の固定位置に配置されています。

では、今回はHUDを継承した簡単なサンプルを提示したいと思います。
画面上の上部に白い四角を描きたいと思います。
まずはHUDを継承したTestBarクラスを作成
import org.anddev.andengine.engine.camera.Camera;
import org.anddev.andengine.engine.camera.hud.HUD;
import org.anddev.andengine.entity.primitive.Rectangle;

public class TestBar extends HUD {

  public TestBar(float pX, float pY, final Camera pCamera) {
    this.setCamera(pCamera);

    final Rectangle btnSubRect = new Rectangle(pX, pY, pCamera.getWidth(), 30);
    btnSubRect.setColor(1, 1, 1);
    this.attachChild(btnSubRect);

    pCamera.setHUD(this);
  }
}
BaseGameActivityを継承したクラスのonLoadScene()でSceneにsetChildSceneとして作成したクラスのインスタンスを渡す。
private Scene mScene;
public Scene onLoadScene() {

  mScene = new Scene();
  
  /** ・・省略・・ **/
  
  final TestBar testbar = new TestBar(0, 0, this.mBoundChaseCamera);
  
  /** ・・省略・・ **/
  
  return mScene;
}

以上の内容を実行すると下の画像のようになります。
DigitalOnScreenControlでプレイヤーを移動させても画面の上部に白い四角は固定された位置に描画され続けます。

AndEngine.orgのHUDの記事にHUDの説明とCreatingとRemovingについて例が載っています。

2012年1月12日木曜日

【AndEngine】TMX map を使った簡単な例 プレイヤーを移動させる(AStarPath編)

前回はプレイヤーの移動する座標をpathに登録しましたが、今回は2点間の最短経路をpathに登録してプレイヤーを移動させる方法についてです。
タワーディフェンス系のゲームで敵がゴールに向かって最短経路で進んだりするやつです。


AStarPathFinderクラスのfindPathメソッドで最短経路のPathを取得できます。
ただしfindPathメソッドで定義したApathはタイルの列と行なので座標に変換する必要があります。

/AStarPathを定義
final org.anddev.andengine.util.path.Path Apath;
// findpath()の動作を定義
final ITiledMap<TMXLayer> tmap = new ITiledMap<TMXLayer>(){

  public int getTileColumns() {
    return mTMXTiledMap.getTileColumns();
  }

  public int getTileRows() {
     return mTMXTiledMap.getTileRows();
  }

  // findpath()で処理されるときに処理する必要があるコードはここに記述
  public void onTileVisitedByPathFinder(int pTileColumn, int pTileRow) {
  }

   // どのブロックをブロックしたいかカスタマイズできる
   Lets you customize what blocks you want to be considered blocked
  public boolean isTileBlocked(TMXLayer pEntity, int pTileColumn, int pTileRow) {
    // false by defaultの場合はブロックは無し
        return false;
  }

  // 重要
  // pathの次のタイルのコストを返却
  public float getStepCost(TMXLayer pEntity, int pFromTileColumn, int pFromTileRow, int pToTileColumn, int pToTileRow) {
    // ↓例
    TMXProperty cost = tmxLayer.getTMXTile(pToTileColumn, pToTileRow).getTMXTileProperties(mTMXTiledMap).get(0);
    return Float.parseFloat(cost.getValue());
  }

};

// AStarPathFinderを宣言
// 第1引数:上記のITiledMap
// 第2引数:最大検索の深さ(この値が小さすぎる場合、プログラムがクラッシュします。)
// 第3引数:斜め移動を許可するかどうか
// 第4引数:(オプション)ヒューリスティック関数の使用
AStarPathFinder<TMXLayer> AStarPath = new AStarPathFinder<TMXLayer>(tmap, 100, false);

// findPath()でpathを作成
// 第1引数:TMXLayerの場合、上記ITiledMapとAStarPathFinder関数を使ってテンプレート化。
// 第2引数:最大のコスト(1タイルではなく終了までの値。値が小さすぎる場合、プログラムがクラッシュします。)
// 第3引数&第4引数:スタートタイルの場所(列と行で指定)
// 第5引数&第6引数:エンドタイルの場所(列と行で指定)
Apath = AStarPath.findPath(this.mTMXTiledMap.getTMXLayers().get(0), 100, 1, 13, 5, 12);

// プレイヤーのエンドタイルの場所をセットしておく
final TMXTile tmxTile = tmxLayer.getTMXTile(5, 12);
if(tmxTile != null) {
  player.setPosition(tmxTile.getTileX(), tmxTile.getTileY());
}

// 実際にスプライトを操作するための座標ベースのパスを宣言
final Path path = new Path(Apath.getLength());

int tilewidth = mTMXTiledMap.getTileWidth();
int tileheight = mTMXTiledMap.getTileHeight();

// 座標ベースのパスからAStarPath用に変換
for(int i=0;i < Apath.getLength();i++)
{
  path.to((Apath.getTileColumn(i) * tilewidth), (Apath.getTileRow(i) * tileheight));
}

// スプライトの移動時間をそれぞれのタイルで0.5になるように設定
// Move the sprite, the duration in PathModifier sets each tile to a .5 duration
player.registerEntityModifier(new PathModifier((Apath.getLength()/2), path, null, new IPathModifierListener() {
  public void onPathStarted(PathModifier pPathModifier, IEntity pEntity) {
  }

  public void onPathWaypointStarted(PathModifier pPathModifier, IEntity pEntity, int pWaypointIndex) {
  }

  public void onPathWaypointFinished(PathModifier pPathModifier, IEntity pEntity, int pWaypointIndex) {
  }

  public void onPathFinished(PathModifier pPathModifier, IEntity pEntity) {
  }
}));


Class Path(org.anddev.andengine.util.path.Path)

Class AStarPathFinder

2012年1月10日火曜日

【AndEngine】TMX map を使った簡単な例 プレイヤーを移動させる(Path編)

RPGなどで町の中の人などが決められたルートを歩いていたりする。
そういったことを実現するための方法。

変数等は前回までのコードか参考元のソースを参考に

Pathを生成してルートを指定。
PathModifierを生成。
final Path path = new Path(5).to(20, 20).to(0, 100).to(100, 100).to(100, 20).to(20, 20);
final PathModifier pathModifier = new PathModifier(10, path, null, new IPathModifierListener(){
  
  public void onPathStarted(PathModifier pPathModifier, IEntity pEntity) {
  }
  public void onPathWaypointStarted(PathModifier pPathModifier, IEntity pEntity, int pWaypointIndex) {
    //ここにプレイヤーのアニメーション等を記述
  }
  
  public void onPathWaypointFinished(PathModifier pPathModifier, IEntity pEntity, int pWaypointIndex) {
  }

  public void onPathFinished(PathModifier pPathModifier, IEntity pEntity) {
  }
});
  


player(AnimatedSpriteクラス)にpathModifierを登録

player.registerEntityModifier(pathModifier);

//Pathをループさせたい場合はLoopEntityModifierを挟む
//player.registerEntityModifier(new LoopEntityModifier(pathModifier));
  




2012年1月9日月曜日

【AndEngine】TMX map を使った簡単な例 DigitalOnScreenControlでスプライトを移動

前回ではDigitalOnScreenControlでプレイヤーを操作するところまででした。

今回はDigitalOnScreenControlでプレイヤーを移動することをします。

概要
・physics worldを作成
・プレイヤーを物理シミュレーション上で動くようにBodyを作成
・DigitalOnScreenControlの操作でプレイヤーを動かす


public Scene onLoadScene() {
  this.mEngine.registerUpdateHandler(new FPSLogger());

  // Create physics world
  this.mPhysicsWorld = new FixedStepPhysicsWorld(30, new Vector2(0, 0), false, 3, 2);

  //Create the scene and register the physics world
  mScene = new Scene();
  mScene.registerUpdateHandler(this.mPhysicsWorld);

  //TMX mapの読み込み
  try {
    final TMXLoader tmxLoader = new TMXLoader(this, this.mEngine.getTextureManager(), // TextureOptions.BILINEAR_PREMULTIPLYALPHA,
        TextureOptions.NEAREST);
    this.mTMXTiledMap = tmxLoader.loadFromAsset(this, "tmx/ground1.tmx");
  } catch (final TMXLoadException tmxle) {
    Debug.e(tmxle);
  }

  // レイヤーをSceneに結びつける
  for (int i = 0; i < this.mTMXTiledMap.getTMXLayers().size(); i++){
    TMXLayer layer = this.mTMXTiledMap.getTMXLayers().get(i);
    mScene.attachChild(layer);

  }

  // カメラがTMXLayerの境界を超えないようにする
  final TMXLayer tmxLayer = this.mTMXTiledMap.getTMXLayers().get(0);
  this.mBoundChaseCamera.setBounds(0, tmxLayer.getWidth(), 0, tmxLayer.getHeight());
  this.mBoundChaseCamera.setBoundsEnabled(true);


  //プレイヤーの表示
  final int centerX = (CAMERA_WIDTH - this.mPlayerTextureRegion.getTileWidth()) / 2;
  final int centerY = (CAMERA_HEIGHT - this.mPlayerTextureRegion.getTileHeight()) / 2;

  final AnimatedSprite player = new AnimatedSprite(centerX, centerY, this.mPlayerTextureRegion);
  this.mBoundChaseCamera.setChaseEntity(player);
  final FixtureDef playerFixtureDef = PhysicsFactory.createFixtureDef(0, 0, 0.5f);
  final Body mPlayerBody = PhysicsFactory.createBoxBody(this.mPhysicsWorld, player,
      BodyType.DynamicBody, playerFixtureDef);
  this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(player,
      mPlayerBody, true, false){
    @Override
    public void onUpdate(float pSecondsElapsed){
      super.onUpdate(pSecondsElapsed);
      mBoundChaseCamera.updateChaseEntity();
    }
  });
  mScene.attachChild(player);

  //プレイヤーのコントロール
  this.mDigitalOnScreenControl = new DigitalOnScreenControl(0,
      CAMERA_HEIGHT - this.mOnScreenControlBaseTextureRegion.getHeight(),
      this.mBoundChaseCamera,
      this.mOnScreenControlBaseTextureRegion,
      this.mOnScreenControlKnobTextureRegion, 0.1f,
      new IOnScreenControlListener() {
    public void onControlChange(final BaseOnScreenControl pBaseOnScreenControl,
        final float pValueX, final float pValueY) {
      // Set the correct walking animation
      if (pValueY == 1){
        // Up
        if (playerDirection != PlayerDirection.UP){
          player.animate(ANIMATE_DURATION, 0, 2, true);
          playerDirection = PlayerDirection.UP;
        }
      }else if (pValueY == -1){
        // Down
        if (playerDirection != PlayerDirection.DOWN){
          player.animate(ANIMATE_DURATION, 9, 11, true);
          playerDirection = PlayerDirection.DOWN;
        }
      }else if (pValueX == -1){
        // Left
        if (playerDirection != PlayerDirection.LEFT){
          player.animate(ANIMATE_DURATION, 3, 5, true);
          playerDirection = PlayerDirection.LEFT;
        }
      }else if (pValueX == 1){
        // Right
        if (playerDirection != PlayerDirection.RIGHT){
          player.animate(ANIMATE_DURATION, 6, 8, true);
          playerDirection = PlayerDirection.RIGHT;
        }
      }else{
        if (player.isAnimationRunning()){
          player.stopAnimation();
          playerDirection = PlayerDirection.NONE;
        }
      }
      // Set the player's velocity
      mPlayerBody.setLinearVelocity(pValueX * PLAYER_VELOCITY, pValueY * PLAYER_VELOCITY);
    }
  });
  this.mDigitalOnScreenControl.getControlBase().setBlendFunction(GL10.GL_SRC_ALPHA,
      GL10.GL_ONE_MINUS_SRC_ALPHA);
  this.mDigitalOnScreenControl.getControlBase().setAlpha(0.5f);
  this.mDigitalOnScreenControl.getControlBase().setScaleCenter(0, 128);
  this.mDigitalOnScreenControl.getControlBase().setScale(1.25f);
  this.mDigitalOnScreenControl.getControlKnob().setScale(1.25f);
  this.mDigitalOnScreenControl.getControlKnob().setAlpha(0.5f);
  this.mDigitalOnScreenControl.refreshControlKnobPosition();

  mScene.setChildScene(this.mDigitalOnScreenControl);

  return mScene;
}


解説
前回のコードに追記する形でonLoadScene()メソッド内のコードを載せています。

5行目でphysics worldを作成しています。
これを9行目でSceneに対UpdateHandlerとして登録しています。

physics worldについては以下を参考にしてください。
AndEnginePhysicsBox2DExtension::Creating A Physicsworld

38から49行目でBodyを作成しています。

93行目でBodyに対して速度を設定しています。

以上でプレイヤーはDigitalOnScreenControlの操作で移動することができます。





2012年1月7日土曜日

【AndEngine】TMX map を使った簡単な例 スプライトとDigitalOnScreenControl

前回の続き


今回の内容
・TMX mapにプレイヤーのスプライトを表示
・プレイヤーをDigitalOnScreenControlで操作できるようにする。


概要
onLoadResources()
・スプライトのテクスチャ読み込み
・DigitalOnScreenControlのテクスチャを読み込み
(画像については前回同様、TileCollision.zipに含まれている画像を使用)

onLoadScene()
・プレイヤーを表示
・DigitalOnScreenControlでプレイヤーを操作

クラス変数にenumを定義。その他必要な物は元のソースを参考に追加

private enum PlayerDirection{
  NONE,
  UP,
  DOWN,
  LEFT,
  RIGHT
}
private PlayerDirection playerDirection = PlayerDirection.NONE;


onLoadResources()

public void onLoadResources() {
  BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/"); // assets/gfx配下に画像が置かれていること
  // Control texture
  this.mOnScreenControlTexture = new BitmapTextureAtlas(256, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
  this.mOnScreenControlBaseTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_base.png", 0, 0);
  this.mOnScreenControlKnobTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mOnScreenControlTexture, this, "onscreen_control_knob.png", 128, 0);

  // Player sprite texture
  this.mTexturePlayer = new BitmapTextureAtlas(128, 128, TextureOptions.DEFAULT);
  this.mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mTexturePlayer, this, "hero.png", 0, 0, 3, 4);

  // Load the textures
  this.mEngine.getTextureManager().loadTextures(this.mTexturePlayer, this.mOnScreenControlTexture);
}



onLoadScene()

public Scene onLoadScene() {

  /*・・省略(TMX mapの読み込み等)・・*/
 
  //プレイヤーのアニメーションをインスタンス化
  final int centerX = (CAMERA_WIDTH - this.mPlayerTextureRegion.getTileWidth()) / 2;
  final int centerY = (CAMERA_HEIGHT - this.mPlayerTextureRegion.getTileHeight()) / 2;
  final AnimatedSprite player = new AnimatedSprite(centerX, centerY, this.mPlayerTextureRegion);
 
  //Sceneにプレイヤーを結びつける
  mScene.attachChild(player);
 
  //プレイヤーのコントロール
  this.mDigitalOnScreenControl = new DigitalOnScreenControl(0,
      CAMERA_HEIGHT - this.mOnScreenControlBaseTextureRegion.getHeight(),
      this.mBoundChaseCamera,
      this.mOnScreenControlBaseTextureRegion,
      this.mOnScreenControlKnobTextureRegion, 0.1f,
      new IOnScreenControlListener() {
        public void onControlChange(final BaseOnScreenControl pBaseOnScreenControl, final float pValueX, final float pValueY) {
          // Set the correct walking animation
          if (pValueY == 1){
            // Up
            if (playerDirection != PlayerDirection.UP){
              player.animate(ANIMATE_DURATION, 0, 2, true);
              playerDirection = PlayerDirection.UP;
            }
          }else if (pValueY == -1){
            // Down
            if (playerDirection != PlayerDirection.DOWN){
              player.animate(ANIMATE_DURATION, 9, 11, true);
              playerDirection = PlayerDirection.DOWN;
            }
          }else if (pValueX == -1){
            // Left
            if (playerDirection != PlayerDirection.LEFT){
              player.animate(ANIMATE_DURATION, 3, 5, true);
              playerDirection = PlayerDirection.LEFT;
            }
          }else if (pValueX == 1){
            // Right
            if (playerDirection != PlayerDirection.RIGHT){
              player.animate(ANIMATE_DURATION, 6, 8, true);
              playerDirection = PlayerDirection.RIGHT;
            }
          }else{
            if (player.isAnimationRunning()){
              player.stopAnimation();
              playerDirection = PlayerDirection.NONE;
            }
          }
        }
    });
  this.mDigitalOnScreenControl.getControlBase().setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
  this.mDigitalOnScreenControl.getControlBase().setAlpha(0.5f);
  this.mDigitalOnScreenControl.getControlBase().setScaleCenter(0, 128);
  this.mDigitalOnScreenControl.getControlBase().setScale(1.25f);
  this.mDigitalOnScreenControl.getControlKnob().setScale(1.25f);
  this.mDigitalOnScreenControl.getControlKnob().setAlpha(0.5f);
  this.mDigitalOnScreenControl.refreshControlKnobPosition();
  //Sceneの
  mScene.setChildScene(this.mDigitalOnScreenControl);

  return mScene;
}


実行するとこうなります。



今回の内容ではプレイヤーの向きが変わるだけです。
次回ではプレイヤーが移動するようにします。

2012年1月6日金曜日

【AndEngine】TMX map を使った簡単な例

ここのサンプルを参考にした。
[Tutorial] Collision objects from TMX map
リンク先のTileCollision.zipをダウンロードしてTileの画像等を利用しました。

事前に以下のことをする。

  • andengine.jarをライブラリに追加
  • タイルの画像を用意
  • Tiledを使ってtmxファイルを用意
では、TileCollisionを参考にTMX mapの表示をする。
ここでは単にTMX mapを表示するまでの最小限のコードとする。




public class WtMiniTestActivity extends BaseGameActivity {

  static final int CAMERA_WIDTH = 480;
  static final int CAMERA_HEIGHT = 320;

  private TMXTiledMap mTMXTiledMap;
  private BoundCamera mBoundChaseCamera;

  //Scene
  private Scene mScene;

  public Engine onLoadEngine() {
    this.mBoundChaseCamera = new BoundCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
    return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE,
        new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT),
        this.mBoundChaseCamera));
  }

  public void onLoadResources() {
  }

  public Scene onLoadScene() {
    this.mEngine.registerUpdateHandler(new FPSLogger());

    mScene = new Scene();
    //TMX mapの読み込み
    try {
      final TMXLoader tmxLoader = new TMXLoader(this,
          this.mEngine.getTextureManager(), // TextureOptions.BILINEAR_PREMULTIPLYALPHA,
          TextureOptions.NEAREST);
      this.mTMXTiledMap = tmxLoader.loadFromAsset(this, "tmx/ground1.tmx");
    } catch (final TMXLoadException tmxle) {
      Debug.e(tmxle);
    }

    // レイヤーをSceneに結びつける
    for (int i = 0; i < this.mTMXTiledMap.getTMXLayers().size(); i++){
      TMXLayer layer = this.mTMXTiledMap.getTMXLayers().get(i);
      mScene.attachChild(layer);
    }

    // カメラがTMXLayerの境界を超えないようにする
    final TMXLayer tmxLayer = this.mTMXTiledMap.getTMXLayers().get(0);
    this.mBoundChaseCamera.setBounds(0, tmxLayer.getWidth(), 0,
        tmxLayer.getHeight());
    this.mBoundChaseCamera.setBoundsEnabled(true);

    return mScene;
  }

  public void onLoadComplete() {
  }
}


上記のコードで表示されるのが以下の様な感じ

今日はここまで。

2012年1月5日木曜日

【雑記】SyntaxHighlighterを使う

ソースコードの表示テスト


public class HelloWorld{
    public static void main(String [] args) {
        System.out.println("Hello world!");
    }
}



コードを投稿する際に以下の内容を記述
ex.)java



 投稿のコード



参考させていただいたサイト