Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libgdx borderless fullscreen

I try to give the user the option of how he wants to play the game. Window and Fullscreen Mode is no problem. The thing I don't seem to get to work is the borderless fullscreen/windowed fullscreen. I searched the web and found only one site that helped me:

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

I did as I was told and I think it kinda works, my problem is, the windows 10 toolbar at the bottom is always in front of the window. Here the picture of how it looks:

http://imgur.com/hdA3LAb

The color is awful, but just for testing purposes. Code looks like this:

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);
} 

How can I fix this?

Edit: I updated to 1.9.2, which doesn't has the setDisplayMode method. The code now looks like this:

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);
}

Everything works like before, just the borderless fullscreen has the windows toolbar(the thing on the botton) infront of it, just like in the picture. Normal fullscreen works fine.

like image 769
LePotatoCannon Avatar asked Feb 27 '16 11:02

LePotatoCannon


People also ask

Is it better to play fullscreen or fullscreen borderless?

You can't tell the difference visually. However, stick to borderless mode over fullscreen mode if you use multiple monitors. You can access your displays and launch various apps while your game or work stays on the main display. But, there is a downside to borderless mode, depending on your device.

Does fullscreen borderless affect FPS?

Chances are you won't notice a big change in fps. You might even gain a few fps. Also in windows 10, with “fullscreen “optimizations”” you are actually running in borderless fullscreen anyways. Why does my PC start lagging when I play games?

Does HDR work in borderless?

All you need to do is set game to borderless window because HDR will only work in full screen. Once you set that up and restart game its fixed. No need to do all that with drivers as its a game issue.


1 Answers

Just tested the following config on my machine with Windows 10 and it worked:

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);
    }
}

You should set that in DesktopLauncher in desktop module

UPDATE
You should try:

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

Also, what version of LibGDX are you using? I'm on version 1.8.0 and I don't have Gdx.graphics.setDisplayMode() method.

like image 143
Enigo Avatar answered Oct 09 '22 11:10

Enigo