rph*_*101 4 fonts android andengine
您是如何在世界范围内创建自定义前端的?几乎直接来自这个例子:
BitmapTextureAtlas font_texture = new BitmapTextureAtlas(this.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
mFont = FontFactory.createFromAsset(font_texture, this, "comic.ttf", 18f, true, Color.WHITE);
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个错误:
The method createFromAsset(FontManager, ITexture, AssetManager, String, float, boolean, int) in the type FontFactory is not applicable for the arguments (BitmapTextureAtlas, TestGFX5Activity, String, float, boolean, Color)
Run Code Online (Sandbox Code Playgroud)
我尝试了很多不同的组合,无法获得任何工作.我想要字体"comic.ttf",大小18和白色.我该怎么做而不是出错?
终于找到了答案:
final ITexture fontTexture = new BitmapTextureAtlas(this.getTextureManager(),256,256);
mFont = FontFactory.createFromAsset(this.getFontManager(),fontTexture,this.getAssets(),"COMIC.TTF",18f,true,Color.WHITE);
Run Code Online (Sandbox Code Playgroud)
但你必须导入android.graphics.Color 而不是 org.andengine.util.color.Color !!!
| 归档时间: |
|
| 查看次数: |
3365 次 |
| 最近记录: |