end*_*der 8 desktop fullscreen libgdx
所有.只是想知道如何让我的桌面应用程序在启动时全屏显示.我是LibGDX的新手,非常感谢任何帮助.谢谢.
des*_*kun 13
只需fullscreen在您的LwjglApplicationConfiguration:中定义字段:
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.title = "yourGame";
cfg.width = 1024;
cfg.height = 768;
cfg.fullscreen = true;
new LwjglApplication(new ...(), cfg);
Run Code Online (Sandbox Code Playgroud)
要以全屏模式启动游戏,请在桌面启动器的LwjglApplicationConfiguration中设置以下标志(main()函数)
public static void main(String[] args) {
LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.width = 1280;
cfg.height = 720;
// fullscreen
cfg.fullscreen = true;
// vSync
cfg.vSyncEnabled = true;
new LwjglApplication(new YourApplicationListener(), cfg);
}
Run Code Online (Sandbox Code Playgroud)
如果您想以任何分辨率启用全屏,或者从游戏中选项使用桌面默认设置
// set resolution to HD ready (1280 x 720) and set full-screen to true
Gdx.graphics.setDisplayMode(1280, 720, true);
// set resolution to default and set full-screen to true
Gdx.graphics.setDisplayMode(
Gdx.graphics.getDesktopDisplayMode().width,
Gdx.graphics.getDesktopDisplayMode().height,
true
);
Run Code Online (Sandbox Code Playgroud)