androidtexturesandengine

How load a lot of textures in andengine


I am trying to load textures as follows:

private Texture mTexture;
...
    public Textures(final BaseGameActivity activity, final Engine engine) {

        this.mTexture = new Texture(2048, 1024,
                TextureOptions.BILINEAR_PREMULTIPLYALPHA);


        this.mBackgroundTextureRegion = TextureRegionFactory.createFromAsset(
                this.mTexture, activity, "img/back.png", 0, 0);


        this.mSwingBackTextureRegion = TextureRegionFactory.createFromAsset(
                this.mTexture, activity, "img/player.png", 836, 0);
...

I want to load more than 200 textures. However, the current method that I am using is too long.

Are there faster methods to complete it?

I am working in GLES1.


Solution

  • The easiest way to do it is with Texture Packer, found here

    This allows you to add multiple image files in to one easy to load spritesheet. The engine loads this spritesheet in to a texture and creates a class that lets you easily reference each image from that spreadsheet. Turn 200 TextureRegions in to 1 TexturePack.

    I'm using GLES2 and I'm not sure where the source files are for GLES1. Poke around the forums and you should be able to find out how to use them. There has been plenty of talk about it.