Gen*_*aut 5 android background scene andengine
我想设置我的场景背景,但我不知道怎么做!我已经阅读了很多关于此的内容,但我无法使其成功.我是Andengine的开始,很难找到我的问题的准确信息,一切都是主观的.
好吧,我已经在场景中实现了启动画面,同时加载了所有资源和场景.(https://sites.google.com/site/matimdevelopment/splash-screen---easy-way)
然后,我必须为我的menuScene设置一个背景,我认为我需要一个TextureRegion和一个BitmapTextureAtlas来创建每个背景.我这样做:
声明的纹理:
//Fondo escenas
private TextureRegion menuBgTexture;
private BitmapTextureAtlas menuBackgroundTexture;
Run Code Online (Sandbox Code Playgroud)
加载资源和加载场景(当Splash结束时由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();
}
Run Code Online (Sandbox Code Playgroud)
load资源不显示错误,但是loadScenes,Line:SpriteBackground bg = new SpriteBackground(new Sprite(centerX,centerY,menuBgTexture));
我说我必须设置一个新属性(ISpriteVertexBufferObject),这是什么?