我之前已经在libgdx项目中看到过它,所以我知道它是可能的。我想将游戏的FPS显示为应用程序的标题。我似乎无法弄清楚如何做到这一点似乎我的游戏的标题总是静态的。它总是说0.任何帮助都非常感激。
答案 0 :(得分:2)
使用bitmapfont显示您的FPS
BitmapFont font;
@Override
public void create() {
font = new BitmapFont();
batch = new SpriteBatch();
}
@Override
public void render() {
//OpenGL settings
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT);
batch.begin();
Gdx.graphics.setTitle(""+Gdx.graphics.getFramesPerSecond());
batch.end();
}
如果有任何问题发表评论!享受:)
<强>更新强>
答案 1 :(得分:2)
我想你可以添加这样的渲染/控制器方法:
Gdx.graphics.setTitle(&#34;你的fps&#34;);