0
在Android Studio中,我试图用AndEngine创建一个精灵,但它未能显示精灵,它只显示黑屏。我搜索并尝试了几个小时的不同方法。AndEngine无法显示精灵
下面是结构:
-myApplication
-andEngine
-app
-res
-drawable
-stand.png
这里是代码:
@Override
public void onCreateResources() {
this.mBitmapTextureAtlas = new BitmapTextureAtlas(getTextureManager(), 30, 30, TextureOptions.DEFAULT);
mPlayerTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromResource(mBitmapTextureAtlas, this, R.drawable.stand, 0, 0);
mBitmapTextureAtlas.load();
}
@Override
public Scene onCreateScene() {
this.mEngine.registerUpdateHandler(new FPSLogger());
this.mMainScene = new Scene();
this.mMainScene.setBackground(new Background(1, 1, 1));
final Sprite oPlayer = new Sprite(100, 100, mPlayerTextureRegion, getVertexBufferObjectManager());
this.mMainScene.attachChild(oPlayer);
return this.mMainScene;
}
任何帮助将理解
感谢。
我已经用JBox2d完成了游戏,如果我有时间我可以再次用AndEngine测试它,谢谢无论如何。 – jdleung