gpt4 book ai didi

java - libgdx 无边框全屏

转载 作者:搜寻专家 更新时间:2023-10-31 20:00:46 25 4
gpt4 key购买 nike

我尝试让用户选择他想要玩游戏的方式。窗口和全屏模式没问题。我似乎没有开始工作的是无边界全屏/窗口全屏。我在网上搜索了一下,发现只有一个网站对我有帮助:

http://badlogicgames.com/forum/viewtopic.php?f=11&t=13863

我按照我说的做了,我觉得它有点管用,我的问题是,底部的 Windows 10 工具栏总是在窗口前面。这是它的外观图片:

http://imgur.com/hdA3LAb

颜色很糟糕,但仅用于测试目的。代码如下所示:

if (screenManager.FULLSCREEN) {
Gdx.graphics.setDisplayMode(Gdx.graphics.getDesktopDisplayMode().width, Gdx.graphics.getDesktopDisplayMode().height, true);
} else if (screenManager.WINDOWEDFULLSCREEN) {
System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");
Gdx.graphics.setDisplayMode(Gdx.graphics.getDesktopDisplayMode().width,
Gdx.graphics.getDesktopDisplayMode().height, false);
} else {
Gdx.graphics.setDisplayMode(screenManager.WIDTH, screenManager.HEIGTH, false);
}

我该如何解决这个问题?

编辑:我更新到 1.9.2,它没有 setDisplayMode 方法。代码现在看起来像这样:

DisplayMode mode = Gdx.graphics.getDisplayMode();
if (screenManager.FULLSCREEN) {
Gdx.graphics.setWindowedMode(Gdx.graphics.getDisplayMode().width, Gdx.graphics.getDisplayMode().height);
Gdx.graphics.setFullscreenMode(mode);
} else if (screenManager.WINDOWEDFULLSCREEN) {
System.setProperty("org.lwjgl.opengl.Window.undecorated", "true");
Gdx.graphics.setWindowedMode(Gdx.graphics.getDisplayMode().width, Gdx.graphics.getDisplayMode().height);
//Gdx.graphics.setFullscreenMode(mode);
} else {
Gdx.graphics.setWindowedMode(screenManager.WIDTH, screenManager.HEIGTH);
}

一切都和以前一样,只是无边框全屏前面有窗口工具栏(按钮上的东西),就像图片中一样。正常的全屏工作正常。

最佳答案

刚刚在我的 Windows 10 机器上测试了以下配置,它工作正常:

public class DesktopLauncher {
public static void main (String[] arg) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = LwjglApplicationConfiguration.getDesktopDisplayMode().width;
config.height = LwjglApplicationConfiguration.getDesktopDisplayMode().height;
config.fullscreen = true;
new LwjglApplication(new MyGame(), config);
}
}

你应该在桌面模块的 DesktopLauncher 中设置它

更新
你应该尝试:

Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode());

此外,您使用的是哪个版本的 LibGDX?我使用的是 1.8.0 版,但没有 Gdx.graphics.setDisplayMode() 方法。

关于java - libgdx 无边框全屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35668943/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com