六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 132|回复: 0

AndEngine 分析之八------Texture

[复制链接]

升级  55.33%

37

主题

37

主题

37

主题

秀才

Rank: 2

积分
133
 楼主| 发表于 2013-1-30 04:29:45 | 显示全部楼层 |阅读模式
[size=125%]Texture:
A Texture is a 'image' in the memory of the graphics chip. On Android the width and height of a Texture has to be a power of 2. Therefore AndEngine assembles a Texture from a couple of ITextureSources, so the space can be used better.
 
一个Texture是一个'图片'在内存中的图形片段。在操作系统一个质地的宽度和高度有是2的度。因此andengine集成一个Texture从一对itexturesources,所以空间可以被使用更好。
 
当继承自BaseGameActivity的类覆写onLoadResources()时
 
public void onLoadResources() {this.mFontTexture = new Texture(256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA);this.mFont = new Font(this.mFontTexture, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32, true, Color.BLACK);this.mEngine.getTextureManager().loadTexture(this.mFontTexture);this.mEngine.getFontManager().loadFont(this.mFont);} 
 
1.构造方法:
 
/** * @param pWidth must be a power of 2 (i.e. 32, 64, 128, 256, 512, 1024). * @param pHeight must be a power of 2 (i.e. 32, 64, 128, 256, 512, 1024). */public Texture(final int pWidth, final int pHeight) {this(pWidth, pHeight, TextureOptions.DEFAULT, null);} 2.engine加载Texture
 
this.mEngine.getTextureManager().loadTexture(this.mFontTexture); 
 
[size=125%]

 
 
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表