【发布时间】:2013-02-07 16:30:50
【问题描述】:
我有一个背景纹理,并想将其更改为其他背景纹理。我已经阅读并测试了一些关于背景纹理的示例,但第二个背景没有显示。
这是我用来尝试更改的最后一个代码...有人可以帮忙吗? 谢谢
Scene scene1 = new Scene();
ITexture backgroundTexture1 = null;
try {
backgroundTexture1 = new BitmapTexture(this.getTextureManager(), new IInputStreamOpener() {
@Override
public InputStream open() throws IOException {
return getAssets().open("gfx/crackedscreen.png");
}
});
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
backgroundTexture1.load();
this.mBackgroundTextureRegion1 = TextureRegionFactory.extractFromTexture(backgroundTexture1);
Sprite backgroundSprite = new Sprite(0, 0, this.mBackgroundTextureRegion1, getVertexBufferObjectManager());
scene1.attachChild(backgroundSprite);
scene1.setBackgroundEnabled(true);
return scene1;
【问题讨论】:
-
只改变加载到这个区域的纹理mBackgroundTextureRegion1
-
我已更新代码以加载新纹理,但没有任何变化。仍然显示第一个背景。谢谢。
标签: android background andengine