1

プライベート カメラ mCamera; プライベート シーン mMainScene;

private BitmapTextureAtlas mBitmapTextureAtlas;
private TextureRegion mPlayerTextureRegion;

@Override
public EngineOptions onCreateEngineOptions() {
    this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);

    return new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera);
}
@Override
public void onCreateResources(
        OnCreateResourcesCallback pOnCreateResourcesCallback)
        throws Exception {
    mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32);
    mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
    mBitmapTextureAtlas.load();

}

@Override
public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback)
        throws Exception {
    this.mEngine.registerUpdateHandler(new FPSLogger()); 


    this.mMainScene = new Scene();
    this.mMainScene.setBackground(new Background(1, 1, 1));

    final int iStartX = (CAMERA_WIDTH - mBitmapTextureAtlas.getWidth()) / 2;
    final int iStartY = (CAMERA_HEIGHT - mBitmapTextureAtlas.getHeight()) / 2;


    final Sprite oPlayer = new Sprite(iStartX, iStartY, mPlayerTextureRegion, getVertexBufferObjectManager());
    this.mMainScene.attachChild(oPlayer);

}

私のスプライトは半分にカットされたように見えます。誰かが理由を説明できますか?背景色はまだ黒で、白にする必要があります。

4

1 に答える 1

0

onCreateScene() メソッドでシーンを返す必要があります。そして、スプライトが半分にカットされているように見えると言いましたが、画像サイズが bitmaptextureAtlas よりも大きい可能性があります。その場合は、textureAtlas のサイズを大きくしてください。

于 2013-09-10T08:47:42.360 に答える