better way to check if display settings changed
This commit is contained in:
parent
4d16508625
commit
97dd34cfc3
|
@ -134,8 +134,6 @@ public class Options {
|
||||||
/** Port binding. */
|
/** Port binding. */
|
||||||
private static int port = 49250;
|
private static int port = 49250;
|
||||||
|
|
||||||
public static boolean wasResolutionChanged;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the XDG flag in the manifest (if any) is set to "true".
|
* Returns whether the XDG flag in the manifest (if any) is set to "true".
|
||||||
* @return true if XDG directories are enabled, false otherwise
|
* @return true if XDG directories are enabled, false otherwise
|
||||||
|
@ -311,20 +309,8 @@ public class Options {
|
||||||
return resolutionIdx + "";
|
return resolutionIdx + "";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ALLOW_LARGER_RESOLUTIONS ("Allow large resolutions", "AllowLargeRes", "Allow resolutions larger than the native resolution", false) {
|
ALLOW_LARGER_RESOLUTIONS ("Allow large resolutions", "AllowLargeRes", "Allow resolutions larger than the native resolution", false),
|
||||||
@Override
|
FULLSCREEN ("Fullscreen Mode", "Fullscreen", "Restart to apply changes.", false),
|
||||||
public void click(GameContainer container) {
|
|
||||||
super.click(container);
|
|
||||||
wasResolutionChanged = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
FULLSCREEN ("Fullscreen Mode", "Fullscreen", "Restart to apply changes.", false) {
|
|
||||||
@Override
|
|
||||||
public void click(GameContainer container) {
|
|
||||||
super.click(container);
|
|
||||||
wasResolutionChanged = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
SKIN ("Skin", "Skin", "Restart (Ctrl+Shift+F5) to apply skin changes.") {
|
SKIN ("Skin", "Skin", "Restart (Ctrl+Shift+F5) to apply skin changes.") {
|
||||||
@Override
|
@Override
|
||||||
public String getValueString() { return skinName; }
|
public String getValueString() { return skinName; }
|
||||||
|
@ -1360,6 +1346,10 @@ public class Options {
|
||||||
return resolutionIdx;
|
return resolutionIdx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean allowLargeResolutions() {
|
||||||
|
return GameOption.ALLOW_LARGER_RESOLUTIONS.getBooleanValue();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the target frame rate.
|
* Returns the target frame rate.
|
||||||
* @return the target FPS
|
* @return the target FPS
|
||||||
|
|
|
@ -509,19 +509,19 @@ public class OptionsMenu extends BasicGameState {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int lastResIdx;
|
private String resolutionOptions;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enter(GameContainer container, StateBasedGame game)
|
public void enter(GameContainer container, StateBasedGame game)
|
||||||
throws SlickException {
|
throws SlickException {
|
||||||
UI.enter();
|
UI.enter();
|
||||||
currentTab = OptionTab.DANCE;
|
currentTab = OptionTab.DANCE;
|
||||||
lastResIdx = Options.getResolutionIdx();
|
resolutionOptions = "" + Options.getResolutionIdx() + Options.isFullscreen() + Options.allowLargeResolutions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void leave(GameContainer container, StateBasedGame game) throws SlickException {
|
public void leave(GameContainer container, StateBasedGame game) throws SlickException {
|
||||||
if (Options.wasResolutionChanged || Options.getResolutionIdx() != lastResIdx) {
|
if (!("" + Options.getResolutionIdx() + Options.isFullscreen() + Options.allowLargeResolutions()).equals(resolutionOptions)) {
|
||||||
container.setForceExit(false);
|
container.setForceExit(false);
|
||||||
container.exit();
|
container.exit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user