How do I set the screen resolution when starting my game. Would like when the game starts to change the screen resolution to 1920x1080 (Full HD). I'm slowly looking stupid... I noticed that it doesn't jump to "isDisplayChangeSupported()". And I don't quite understand the exclusive full-screen mode either. I coded something with “Frame”. But then he opens a new window for me.
I just want to change the resolution in the game code when I start the game. I could also show my financial appreciation...
public BaseScreen()
{
GraphicsDevice dev = GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice();
GraphicsConfiguration gc = dev.getDefaultConfiguration();
DisplayMode[] dms = dev.getDisplayModes();
for (DisplayMode dm : dms) {
System.out.println(dm.getHeight() + "x" + dm.getWidth());
}
DisplayMode mode = new DisplayMode(1920, 1080, 32, DisplayMode.REFRESH_RATE_UNKNOWN);
if (dev.isDisplayChangeSupported()) {
dev.setDisplayMode(mode);
System.out.println("Hell Yeah");
}
There is going to be a way to get your solution working, but its going to be better to follow how to do it here https://libgdx.com/wiki/graphics/querying-and-configuring-graphics Also it's better not to specify a
new DisplayMode(...yourself, even though its a standard 1920x1080 its better to use an existing one and you find that by searching through the supported modes for an appropriate match. btw There is an active discord server for libGDX users you can join.