Full screen without libgdx frame

I am trying to give the user the opportunity how he wants to play the game. Window and full screen mode is not a problem. It seems to me that I am not working, it is full-screen full-screen / window full-screen mode. I searched the Internet 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 works, my problem is that the Windows 10 toolbar at the bottom is always in front of the window. Here is a picture of how it looks:

http://imgur.com/hdA3LAb

The color is terrible, but only for testing purposes. The code is as follows:

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 upgraded to 1.9.2, which does not have a setDisplayMode method. Now the code is as follows:

 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 the same as before, only in full-screen mode without borders there is a Windows toolbar (thing on botton), as in the picture. Normal full screen mode works great.

+5
source share
1 answer

Just tested the following configuration on my windows 10 machine 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 must install this in the DesktopLauncher in the desktop module

UPDATE
You must try:

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

Also, which version of LibGDX are you using? I am on version 1.8.0 and I do not have the Gdx.graphics.setDisplayMode() method.

+4
source

Source: https://habr.com/ru/post/1244004/


All Articles