我正在尝试使用libgdx的BitmapFont
来渲染简单文本:
font = new BitmapFont();
font.draw(batch, "Tap anywhere to begin!", 100, 100);
在桌面端运行良好,但在Android上会产生以下错误:
07-30 08:12:35.518: ERROR/AndroidRuntime(817): FATAL EXCEPTION: GLThread 82
com.badlogic.gdx.utils.GdxRuntimeException: File not found: com/badlogic/gdx/utils/arial-15.fnt (Classpath)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:132)
at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:77)
at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.<init>(BitmapFont.java:715)
at com.badlogic.gdx.graphics.g2d.BitmapFont.<init>(BitmapFont.java:114)
at com.badlogic.gdx.graphics.g2d.BitmapFont.<init>(BitmapFont.java:73)
at com.mangokidzee.amphibian.Activity1.create(Activity1.java:23)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:322)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
似乎无法加载字体文件
File not found: com/badlogic/gdx/utils/arial-15.fnt (Classpath)
我正在使用 IntelliJ IDEA
而不是 Eclipse IDE。我认为这是由于某些路径配置问题,但无法弄清楚具体原因。有人能帮我吗?
更新
我打开了使用 Eclipse
创建的样本 libgdx 演示 APK,它在 gdx 的 utils
文件夹中有这4个文件:
- arial-15.fnt
- arial-15.png
- JsonReader.rl
- XmlReader.rl
而在使用 IntelliJ
生成的 APK 中,只有2个文件:
- JsonReader.rl
- XmlReader.rl
arial-15
缺失。