我已经使用 LibGDX UI Setup 来启动一个项目.
I've used the LibGDX UI Setup to start a project.
我在实现 ApplicationListener 中唯一的东西是:
The only thing I have in the implements ApplicationListener is:
public void create() {
setScreen(new LoadingScreen(this));
}
这应该会触发 LoadingScreen 并且确实如此,因为我在它的构造函数中有一个打印并且它确实显示了.我在渲染方法中有一个打印,它只显示一次,我知道这应该打印很多次,因为渲染方法每隔很短的时间就会被调用一次.
This is supposed to fire the LoadingScreen and it does since I have a print in its constructor and it does show. I have a print in the render method and it's only shown once and I understand this should be printed a lot of times since the render method is called every short period of time.
这是我在 render() 方法中的内容(打印除外):
Here's what I have in the render() method (apart from the print):
OpenGL.glClearColor(1, 0.5f, 1, 1);
OpenGL.glClear(GL10.GL_COLOR_BUFFER_BIT);
其中 OpenGL = Gdx.graphics.getGL10();
正如我所说,我认为渲染只被调用一次,当我执行桌面主程序时,我在屏幕上看到的是一个从粉红色到黑色闪烁的图像,以及从上到下的条形.
As I said I think render is only called once and what I see in the screen when I execute the desktop main is an image blinking from pink to black and bars going from top to bottom.
以防万一它对某人有所帮助.
Just in case it It helps someone.
通过在 Game 扩展类中添加 render 方法解决了这个问题:
The problem was solved by adding to the render method in the Game extending class this:
public void render() {
super.render();
}
现在它不会闪烁,并且每个屏幕的渲染都被一遍又一遍地调用,因为它应该发生.
Now it does not blink and each screen's render is called over and over as it is supposed to happen.
这篇关于LibGDX 闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!