1
我有一個背景紋理,並希望將其更改爲其他背景紋理。我已經閱讀並測試了一些關於背景紋理的樣本,但第二個背景並沒有顯示。如何更改AndEngine上的背景紋理?
這是我用來嘗試更改的最後一個代碼...任何人都可以提供幫助嗎? 感謝
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 –
我已經更新了代碼的質感,加載新的紋理,但沒有變化。仍然顯示第一個背景。謝謝。 – user1847912