你好下面的代码试图将自定义字体作为标签。每当我用调试模式绘制它时,我都会在文本应该显示的地方得到一个绿色框,但是没有任何内容出现。我从来没有使用自定义字体,只有我的电脑上已安装的字体。然而,我的资产文件夹中有“.png”,所以我不明白为什么它没有绘图。libgdx - bmfont自定义字体不绘图?
stacktrace中没有错误,下面的图片可以帮助描述问题。
public void show() {
stage = new Stage();
float delta = Gdx.graphics.getDeltaTime();
stage.setDebugAll(true); // Set outlines for Stage elements for easy debug
BitmapFont white = new BitmapFont(Gdx.files.internal("hazey.fnt"), false);
white.setScale(2);
LabelStyle headingStyle = new LabelStyle(white, Color.BLACK);
Label gameoverstring = new Label("game over", headingStyle);
gameoverstring.setPosition(100, 100);
stage.addActor(gameoverstring);
}
// Called every frame so try to put no object creation in it
@Override
public void render(float delta) {
Gdx.gl.glClearColor((float)96/255,(float)96/255,(float)96/255, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
System.out.println("hey");
stage.act(delta);
stage.draw();
}