4

您到底是如何创建自定义前端的?几乎直接来自示例:

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 号,白色。我该如何做到这一点,而不是得到那个错误?

4

1 回答 1

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 !!!

于 2012-07-02T07:02:07.840 回答