我想設置我的場景背景,但我不知道如何!我已經閱讀了很多關於這方面的內容,但我無法做到這一點。我是從Andengine開始的,很難找到我的問題的確切信息,都是主觀的。添加背景Andengine場景Android
好了,我已經實現在場景中的閃屏,同時負載的所有資源和場景。 (https://sites.google.com/site/matimdevelopment/splash-screen---easy-way)
然後,我必須設置一個背景到我的menuScene,我認爲我需要一個TextureRegion和一個BitmapTextureAtlas來創建每個背景。我這樣做:
聲明紋理:
//Fondo escenas
private TextureRegion menuBgTexture;
private BitmapTextureAtlas menuBackgroundTexture;
加載資源和加載場景(他們被onPopulateScene稱爲飛濺結束時)
public void loadResources()
{
//FondoMenu
menuBackgroundTexture = new BitmapTextureAtlas(null, 480, 320, TextureOptions.DEFAULT);
menuBgTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.menuBackgroundTexture, this, "menubg.png", 0, 0);
//Cargamos los fondos
mEngine.getTextureManager().loadTexture(this.menuBackgroundTexture);
}
private void loadScenes()
{
//Menú
menuScene = new Scene();
final float centerX = (CAMERA_WIDTH - menuBgTexture.getWidth())/2;
final float centerY = (CAMERA_HEIGHT - menuBgTexture.getHeight())/2;
SpriteBackground bg = new SpriteBackground(new Sprite(centerX, centerY, menuBgTexture));
menuScene.setBackground(bg);
//menuScene.setBackground(new Background(50, 0, 0));
//Options
optionsScene = new Scene();
//Juego
gameScene = new Scene();
//Pausa
pauseScene = new Scene();
//Gameover
gameOverScene = new Scene();
}
加載資源不顯示錯誤,但loadScenes,行: SpriteBackground bg = new SpriteBackground(new Sprite(centerX,centerY,menuBgTexture));
說我,我要設置一個新的屬性(ISpriteVertexBufferObject),好了,這是什麼?
您使用哪種GLES? GLES2?我在GLES2中有onCreateResources()。我不知道爲什麼Nicolas Gramlich決定重新命名這樣的關鍵功能,以及爲什麼他創建了一個沒有文檔的引擎/庫。任何人都可以提供幫助嗎? – shailenTJ
當談到文檔時,誰知道他在想什麼,上帝禁止你在andengine論壇上對此進行任何說明,如果你被告知應該只讀源代碼並解決它,我的意思是這些很好,但在源代碼中甚至沒有任何評論。它是一個恥辱真的是一個很好的小開源引擎,只是我的兩美分:D – Spider
我也面臨類似的問題...我無法設置我的背景...這裏是代碼..menuBackgroundTexture = new BitmapTextureAtlas null,2 * CAMERA_WIDTH,2 * CAMERA_HEIGHT,TextureOptions.DEFAULT); \t menuBgTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.menuBackgroundTexture,this,「land.png」,0,0); SpriteBackground bg = new SpriteBackground(new Sprite(0,0,menuBgTexture,this.getVertexBufferObjectManager()));}};}};}}}; \t \t mScene.setBackground(bg); ....任何人都可以幫助我嗎? – Rahul