andengine 中的微不足道的纹理加载

发布于 2024-12-13 21:26:17 字数 679 浏览 4 评论 0原文

在 andngine 中,我使用以下行代码定义了一个纹理:

private Texture mTexture;

这是我的 onLoadResource 函数:

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

但是此代码给出了错误,因为“import org.anddev.andengine.opengl.texture.Texture”类中唯一的构造函数具有以下签名:

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

你能帮我做什么吗?大多数教程都使用这样的内容:

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

但我的,不起作用。我们将不胜感激您的帮助。

问候。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

栀子花开つ 2024-12-20 21:26:17

几个月前,原始 Texture 类的大量功能似乎已移至 BitmapTextureAtlas。您应该能够调用具有相同宽度、高度和 TextureOptions 参数的构造函数 - 或您喜欢的任何其他变体。

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) 

这个早期问题中还有一个代码示例。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文