如何在AndEngine中创建自定义字体?

时间:2012-07-02 05:04:34

标签: android fonts andengine

您如何在世界范围内创建自定义阵线?几乎直接来自例子:

BitmapTextureAtlas font_texture = new BitmapTextureAtlas(this.getTextureManager(), 256, 256, TextureOptions.BILINEAR); 
    mFont = FontFactory.createFromAsset(font_texture, this, "comic.ttf", 18f, true, Color.WHITE);

然而我收到了这个错误:

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)

我尝试了很多不同的组合,无法让任何事情发挥作用。我想要字体“comic.ttf”,大小18和白色。我该怎么做却没有得到这个错误?

1 个答案:

答案 0 :(得分:9)

终于找到了答案:

final ITexture fontTexture = new BitmapTextureAtlas(this.getTextureManager(),256,256);

mFont = FontFactory.createFromAsset(this.getFontManager(),fontTexture,this.getAssets(),"COMIC.TTF",18f,true,Color.WHITE);

但是你必须导入android.graphics.Color 而不是 org.andengine.util.color.Color !!!

相关问题