这是我在Libgdx游戏中我的关卡上的当前渲染方法。我正在尝试在我的关卡的右上角绘制BitmapFont,但我得到的只是一堆白色方框。
@Override
public void render(
float delta ) {
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
this.getBatch().begin();
//myScore.getCurrent() returns a String with the current Score
font.draw(this.getBatch(), "Score: 0" + myScore.getCurrent(), 600, 500);
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
this.getBatch().end();
}
我想将得分字体添加到某个角色中,然后执行scene.addActor(myScore),但我不知道如何做。 我遵循Steigert的教程创建了主游戏类来实例化场景、字体,在抽象级别类中,该类被这个级别继承。 目前为止,我没有使用任何自定义字体,只是使用空的new BitmapFont(); 来使用默认Arial字体。以后我想使用我自己更加花哨的字体。