LibGDX闪烁 [英] LibGDX blinking

查看:206
本文介绍了LibGDX闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用LibGDX UI安装启动项目。

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 fires 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.

下面就是我在渲染()方法(除了打印):

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.

该问题是由在这个游戏扩展类增加了渲染方法解决

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闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆