我正在运行 libGDX 应用程序作为动态壁纸。我正在使用 SpriteBatch 和 2D Stage。在三星 S4 上渲染空(黑色)屏幕的成本平均为 16%(使用 adb shell top 测量)。即使考虑到屏幕的大小,也似乎有点多。我的方法有问题吗?
public class TestWallpaper implements ApplicationListener, AndroidWallpaperListener {
...
@Override
public void render () {
if (loading && scene.loadUpdate()) {
doneLoading();
}
float timeDelta = Gdx.graphics.getDeltaTime();
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
if(!loading) {
stage.act(Gdx.graphics.getDeltaTime());
stage.draw();
}
}
}