我想设置我的场景背景,但我不知道如何!我已经阅读了很多关于这方面的内容,但我无法做到这一点。我是从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