v2.5.0: changed desktop fullscreen to actually use borderless window

This commit is contained in:
Evan Debenham
2024-08-18 13:26:07 -04:00
parent 42c24a948f
commit daa267466e
2 changed files with 15 additions and 6 deletions

View File

@@ -174,10 +174,7 @@ public class DesktopLauncher {
config.setWindowedMode( p.x, p.y );
config.setMaximized(SPDSettings.windowMaximized());
//going fullscreen on launch is a bit buggy
// so game always starts windowed and then switches in DesktopPlatformSupport.updateSystemUI
//config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode());
config.setDecorated(!SPDSettings.fullscreen());
//records whether window is maximized or not for settings
DesktopWindowListener listener = new DesktopWindowListener();

View File

@@ -22,6 +22,7 @@
package com.shatteredpixel.shatteredpixeldungeon.desktop;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Graphics;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.g2d.PixmapPacker;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
@@ -50,7 +51,7 @@ public class DesktopPlatformSupport extends PlatformSupport {
previousSizes[1] = previousSizes[0];
}
previousSizes[0] = new Point(Game.width, Game.height);
if (!SPDSettings.fullscreen()) {
if (!SPDSettings.fullscreen() && !SPDSettings.windowMaximized()) {
SPDSettings.windowResolution( previousSizes[0] );
}
}
@@ -61,10 +62,21 @@ public class DesktopPlatformSupport extends PlatformSupport {
@Override
public void run () {
if (SPDSettings.fullscreen()){
Gdx.graphics.setFullscreenMode( Gdx.graphics.getDisplayMode() );
Gdx.graphics.setUndecorated( true );
Graphics.DisplayMode display = Gdx.graphics.getDisplayMode();
Gdx.graphics.setWindowedMode( display.width, display.height );
} else {
Point p = SPDSettings.windowResolution();
Gdx.graphics.setUndecorated( false );
if (SPDSettings.windowMaximized()){
//if we are going from fullscreen to maximized, then don't assign window res
Point newP = SPDSettings.windowResolution();
if (newP.x == p.x && newP.y == p.y){
return;
}
}
Gdx.graphics.setWindowedMode( p.x, p.y );
SPDSettings.windowResolution( p );
}
}
} );