【问题标题】:How do you create a custom font in AndEngine?如何在 AndEngine 中创建自定义字体?
【发布时间】:2012-07-02 05:04:34
【问题描述】:

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

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 号,白色。如何做到这一点而不出现该错误?

【问题讨论】:

    标签: android fonts andengine


    【解决方案1】:

    终于找到答案了:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-28
      • 1970-01-01
      • 2015-05-29
      • 2021-01-10
      • 2014-08-25
      • 1970-01-01
      • 2018-06-24
      • 1970-01-01
      相关资源
      最近更新 更多