[英]Java / Libgdx LwjglApplicationConfiguration backgroundFPS doesn't work
I'm working on a multiplayer game, because of that it should also be rendered and calculated when the window is not in focus. 我正在开发一个多人游戏,因此,当窗口不清晰时,也应该渲染和计算它。 I searched a little bit and found a way for libgdx to render in background, normally it should work by setting backgroundFPS = 0;
我进行了一些搜索,找到了libgdx在后台渲染的方法,通常应通过设置backgroundFPS = 0来工作。 like here :
像这儿 :
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "32 Bit Game v : 0.4.75";
cfg.vSyncEnabled = false;
cfg.forceExit = true;
cfg.backgroundFPS = 0;
cfg.foregroundFPS = 0;
cfg.width = 1920;
cfg.height = 1080;
cfg.fullscreen = false;
cfg.addIcon("Icon/Logo.png", FileType.Internal);
//System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");
new LwjglApplication(new MenuCreate(), cfg);
Like I did in my code, but it doesn't work, every time my game loses focus it still doesn't render. 就像我在代码中所做的一样,但是它不起作用,每次我的游戏失去焦点时,它仍然无法渲染。 Can anyone help me ?
谁能帮我 ?
Due to documentation you should rather use the -1
value 由于文档原因,您应该使用
-1
值
Target framerate when the window is not in the foreground.
窗口不在前景中时的目标帧率。 The CPU sleeps as needed.
CPU根据需要休眠。 Use 0 to never sleep, -1 to not render.
使用0表示从不休眠,使用-1表示不进行渲染。
So it should be: 所以应该是:
cfg.backgroundFPS = -1;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.