Voglio impostare Sfondo scena ma non so come! Avevo letto molto su questo, ma non posso farlo. È il mio esordio con Andengine, ed è difficile trovare informazioni precise per il mio problema, tutto è soggettivo.Aggiungi sfondo alla scena Andengine Android
Bene, ho implementato lo splash screen in una scena e mentre carico tutte le risorse e le scene. (https://sites.google.com/site/matimdevelopment/splash-screen---easy-way)
Quindi, devo impostare uno sfondo per il mio menuScene, penso che ho bisogno di TextureRegion e un BitmapTextureAtlas per creare ogni backgroud. Faccio questo:
texture ha dichiarato:
//Fondo escenas
private TextureRegion menuBgTexture;
private BitmapTextureAtlas menuBackgroundTexture;
Risorse carico ea carico scene (Essi sono chiamati da onPopulateScene quando Splash finisce)
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();
}
Resource carico non mostra errore, ma loadScenes, Linea : SpriteBackground bg = new SpriteBackground (new Sprite (centerX, centerY, menuBgTexture));
Mi dice che devo impostare un nuovo attributo (ISpriteVertexBufferObject), bene, cos'è questo?
Quale GLES stai usando? GLES2? Ho onCreateResources() in GLES2. Non ho idea del perché Nicolas Gramlich abbia deciso di rinominare funzioni chiave come questa, e perché abbia creato un motore/libreria senza documentazione. Qualcuno può fornire aiuto? – shailenTJ
Chissà cosa stava pensando quando si trattava di documentazione, e Dio ti proibisce di dire qualcosa su questo sui forum di andengine, se ti viene detto che devi solo leggere il codice sorgente e risolverlo, voglio dire tutto questo bene e bene, ma non ci sono nemmeno commenti nel codice sorgente della cosa. È un vero peccato, è un bel piccolo motore open source, solo i miei due centesimi: D – Spider
Anche io sto affrontando un problema simile ... Non riesco a impostare il mio background ... ecco il codice ..menuBackgroundTexture = new BitmapTextureAtlas (null, 2 * CAMERA_WIDTH, 2 * CAMERA_HEIGHT, TextureOptions.DEFAULT); \t menuBgTexture = BitmapTextureAtlasTextureRegionFactory.createFromAsset (this.menuBackgroundTexture, "land.png", 0, 0); \t \t SpriteBackground bg = new SpriteBackground (new Sprite (0, 0, menuBgTexture, this.getVertexBufferObjectManager())); \t \t mScene.setBackground (bg); .... qualcuno può aiutarmi? – Rahul