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);


更多相关文章

  1. Android(安卓)通过FontPaint计算字符宽
  2. android 防止bitmap 内存溢出
  3. Android(安卓)的Activity.getWindowManager().getDefaultDisplay
  4. andrid layout_weight 计算 分析
  5. android ImageView 图片宽度全屏,高度自适应的写法
  6. android的fragment使用中static静态fragment实例遇到的坑
  7. 自定义Dialog步骤
  8. Android(安卓)抽屉效果
  9. ConstraintLayout约束布局属性

随机推荐

  1. Android NDK的基本使用,这一篇就够了
  2. Android中 AIDL 的简单实用例子
  3. apk自我保护的一种实现方式——运行时自
  4. WebView 键盘遮挡输入框解决方案
  5. 解决Notification不显示问题支持Android
  6. 要导入android工程灰显的问题
  7. Android(安卓)Service更新UI的方法之AIDL
  8. manifest中的 android:name
  9. Android(安卓)在代码中控制View的填充方
  10. Android(安卓)Studio 中Gradle配置debug