v1.2.1: game settings now remember previous window size when maximized
This commit is contained in:
@@ -39,11 +39,21 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class DesktopPlatformSupport extends PlatformSupport {
|
public class DesktopPlatformSupport extends PlatformSupport {
|
||||||
|
|
||||||
|
//we recall previous window sizes as a workaround to not save maximized size to settings
|
||||||
|
//have to do this as updateDisplaySize is called before maximized is set =S
|
||||||
|
protected static Point[] previousSizes = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDisplaySize() {
|
public void updateDisplaySize() {
|
||||||
//FIXME we still set window resolution when game becomes maximized =/
|
if (previousSizes == null){
|
||||||
|
previousSizes = new Point[2];
|
||||||
|
previousSizes[0] = previousSizes[1] = new Point(Game.width, Game.height);
|
||||||
|
} else {
|
||||||
|
previousSizes[1] = previousSizes[0];
|
||||||
|
previousSizes[0] = new Point(Game.width, Game.height);
|
||||||
|
}
|
||||||
if (!SPDSettings.fullscreen()) {
|
if (!SPDSettings.fullscreen()) {
|
||||||
SPDSettings.windowResolution( new Point( Game.width, Game.height ) );
|
SPDSettings.windowResolution( previousSizes[0] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ public class DesktopWindowListener implements Lwjgl3WindowListener {
|
|||||||
@Override
|
@Override
|
||||||
public void maximized ( boolean b ) {
|
public void maximized ( boolean b ) {
|
||||||
SPDSettings.windowMaximized( b );
|
SPDSettings.windowMaximized( b );
|
||||||
|
if (b){
|
||||||
|
SPDSettings.windowResolution(DesktopPlatformSupport.previousSizes[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user