Android游戏引擎libgdx使用教程:绘制汉字与显示中文
不知大家有没有注意过libgdx显示汉字的问题,其实还是非常值得关注,试想如果libgdx不支持中文,那么使用起来就很不方便了。
我们来看看BitmapFont类,这是有关文字绘制的。看一下源码:
public BitmapFont ()
{
this(Gdx.files.classpath("com/badlogic/gdx/utils/arial-15.fnt"), Gdx.files.classpath("com/badlogic/gdx/utils/arial-15.png"), false, true);
}
这是默认的构造函数,可以看出它加载了两个文件arial-15.fnt和arial-15.png。
arial-15.fnt文件的部分内容:
info face="Arial" size=15 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1
common lineHeight=18 base=14 scaleW=256 scaleH=256 pages=1 packed=0
page id=0 file="arial-15.png"
chars count=189
char id=32 x=0 y=0 width=0 height=0 xoffset= android开发,青软培训