我用LibGDX编写了一个非常简单的测试,
这是我的代码:
public class AndroidLauncher extends AndroidApplication {
private Handler handler;
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(new GameView(), config);
}
public static final class GameView implements ApplicationListener {
private GLProfiler profiler;
@Override
public void create() {
profiler = new GLProfiler(Gdx.graphics);
}
@Override
public void resize(int width, int height) {
}
@Override
public void render() {
DebugLog.d("fps "+ Gdx.graphics.getFramesPerSecond());
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void dispose() {
}
}
}
当我在Android手机(android 4.4.2,Huawei)上运行它时,我什么也不做,Fps保持稳定在61 FPS,但是如果我触摸屏幕,Fps会下降到56-31 ,因此几秒钟后,FPS为31。
有人遇到过这个问题吗?