私人相机 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);
}
我的精灵看起来像是被切成了两半。有人可以解释为什么吗?背景颜色仍然是黑色,应该是白色的。