Добавить фон к сцене Andengine Android

Я хочу установить фон моей сцены, но я не знаю, как это сделать! Я много читал об этом, но я не могу заставить это работать. Мое начало с Andengine, и трудно найти точную информацию для моей проблемы, все субъективно.

Ну, я реализовал заставку в сцене, а пока загружаю все ресурсы и сцены. (https://sites.google.com/site/matimdevelopment/splash-screen---easy-way)

Затем я должен установить фон для моей сцены меню, я думаю, что мне нужен TextureRegion и BitmapTextureAtlas для создания каждого фона. Делаю так:

Объявленные текстуры:

    //Fondo escenas
private TextureRegion menuBgTexture;
private BitmapTextureAtlas menuBackgroundTexture;

Загрузить ресурсы и загрузить сцены (Они вызываются onPopulateScene, когда Splash заканчивается)

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();
}

load Resource не показывает ошибку, но loadScenes, Строка: SpriteBackground bg = новый SpriteBackground (новый Sprite (centerX, centerY, menuBgTexture));

Говорит мне, что я должен установить новый атрибут (ISpriteVertexBufferObject), ну и что это?

5
задан Genaut 7 June 2012 в 14:22
поделиться