2016-02-27 66 views
5

我尝试给用户提供他想要玩游戏的选项。窗口和全屏模式是没有问题的。我似乎无法工作的事情是无边界全屏/窗口全屏。 我在网上搜索,发现只有一个网站,帮助我:libgdx无边框全屏

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

我没有,因为我是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工具栏(在钮的东西),它的盈方,就像在图片。正常的全屏工作正常。

+0

您是否想要移除窗口化应用程序的边框?如果是这样,那么你可能想尝试问“如何从窗口应用程序中删除边框”。从现在开始,你就会把很多人混淆在你的问题中。请在具体问题中提出问题,并将所有不相关的问题都排除在外。 – Madmenyo

+0

@MennoGouw代码实际上已经删除了边界... – LePotatoCannon

回答

4

与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

UPDATE
你应该尝试:

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

另外,什么版本的Lib GDX你在用吗?我在版本1.8.0,我没有Gdx.graphics.setDisplayMode()方法。

+0

如果我这样做,游戏将永远是全屏。但用户应该可以选择从全屏,窗口全屏和窗口模式... – LePotatoCannon

+0

@LePotatoCannon看到更新的答案 – Enigo

+0

我得到了1.6.0,全屏模式工作,我只是有窗口全屏问题,我希望你知道我是什么意思是... – LePotatoCannon