2

In andngine , I defined a texture, using the following line code:

private Texture mTexture;

And here is my onLoadResource function:

   public void onLoadResources() {
this.mTexture = new Texture(64, 64,
TextureOptions.BILINEAR_PREMULTIPLYALPHA);
}

but this code gives an error, because the only constructor in "import org.anddev.andengine.opengl.texture.Texture" class has the following signature:

public Texture(final PixelFormat pPixelFormat, final TextureOptions pTextureOptions, final ITextureStateListener pTextureStateListener); 

Would you please help me what to do? Most tutorials, used something like this:

new Texture(64, 64,
TextureOptions.BILINEAR_PREMULTIPLYALPHA);

But mine, does not work. Your help would be appreciated.

Regards.

Farid Ala
  • 668
  • 1
  • 12
  • 30

1 Answers1

3

It appears that a few months ago a bunch of the functionality of the original Texture class was moved to BitmapTextureAtlas. You should be able to call the constructor of that with the same width, height and TextureOptions parameters - or any of the other variants of your liking.

BitmapTextureAtlas(int pWidth, int pHeight) 
BitmapTextureAtlas(int pWidth, int pHeight, BitmapTextureAtlas.BitmapTextureFormat pBitmapTextureFormat)            
BitmapTextureAtlas(int pWidth, int pHeight, BitmapTextureAtlas.BitmapTextureFormat pBitmapTextureFormat, ITextureAtlas.ITextureAtlasStateListener<IBitmapTextureAtlasSource> pTextureAtlasStateListener)
BitmapTextureAtlas(int pWidth, int pHeight, BitmapTextureAtlas.BitmapTextureFormat pBitmapTextureFormat, TextureOptions pTextureOptions)
BitmapTextureAtlas(int pWidth, int pHeight, BitmapTextureAtlas.BitmapTextureFormat pBitmapTextureFormat, TextureOptions pTextureOptions, ITextureAtlas.ITextureAtlasStateListener<IBitmapTextureAtlasSource> pTextureAtlasStateListener)        
BitmapTextureAtlas(int pWidth, int pHeight, ITextureAtlas.ITextureAtlasStateListener<IBitmapTextureAtlasSource> pTextureAtlasStateListener) 
BitmapTextureAtlas(int pWidth, int pHeight, TextureOptions pTextureOptions) 
BitmapTextureAtlas(int pWidth, int pHeight, TextureOptions pTextureOptions, ITextureAtlas.ITextureAtlasStateListener<IBitmapTextureAtlasSource> pTextureAtlasStateListener) 

There's also a code example in this earlier question.

Community
  • 1
  • 1
MH.
  • 45,303
  • 10
  • 103
  • 116