v2.5.0: undid fullscreen changes, borderless doesn't work in many cases

This commit is contained in:
Evan Debenham
2024-08-18 13:52:02 -04:00
parent daa267466e
commit ac31ef1faa
2 changed files with 8 additions and 17 deletions

View File

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

View File

@@ -22,7 +22,6 @@
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;
@@ -51,32 +50,21 @@ public class DesktopPlatformSupport extends PlatformSupport {
previousSizes[1] = previousSizes[0];
}
previousSizes[0] = new Point(Game.width, Game.height);
if (!SPDSettings.fullscreen() && !SPDSettings.windowMaximized()) {
if (!SPDSettings.fullscreen()) {
SPDSettings.windowResolution( previousSizes[0] );
}
}
@Override
public void updateSystemUI() {
Gdx.app.postRunnable( new Runnable() {
@Override
public void run () {
if (SPDSettings.fullscreen()){
Gdx.graphics.setUndecorated( true );
Graphics.DisplayMode display = Gdx.graphics.getDisplayMode();
Gdx.graphics.setWindowedMode( display.width, display.height );
Gdx.graphics.setFullscreenMode( Gdx.graphics.getDisplayMode() );
} 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 );
}
}
} );