automatically restart when display settings changed
This commit is contained in:
parent
0e43e6f938
commit
4d16508625
|
@ -134,6 +134,8 @@ public class Options {
|
|||
/** Port binding. */
|
||||
private static int port = 49250;
|
||||
|
||||
public static boolean wasResolutionChanged;
|
||||
|
||||
/**
|
||||
* Returns whether the XDG flag in the manifest (if any) is set to "true".
|
||||
* @return true if XDG directories are enabled, false otherwise
|
||||
|
@ -309,8 +311,20 @@ public class Options {
|
|||
return resolutionIdx + "";
|
||||
}
|
||||
},
|
||||
ALLOW_LARGER_RESOLUTIONS ("Allow large resolutions", "AllowLargeRes", "Allow resolutions larger than the native resolution", false),
|
||||
FULLSCREEN ("Fullscreen Mode", "Fullscreen", "Restart to apply changes.", false),
|
||||
ALLOW_LARGER_RESOLUTIONS ("Allow large resolutions", "AllowLargeRes", "Allow resolutions larger than the native resolution", false) {
|
||||
@Override
|
||||
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.") {
|
||||
@Override
|
||||
public String getValueString() { return skinName; }
|
||||
|
@ -1342,6 +1356,10 @@ public class Options {
|
|||
// This class should not be instantiated.
|
||||
private Options() {}
|
||||
|
||||
public static int getResolutionIdx() {
|
||||
return resolutionIdx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the target frame rate.
|
||||
* @return the target FPS
|
||||
|
|
|
@ -509,11 +509,22 @@ public class OptionsMenu extends BasicGameState {
|
|||
}
|
||||
}
|
||||
|
||||
private int lastResIdx;
|
||||
|
||||
@Override
|
||||
public void enter(GameContainer container, StateBasedGame game)
|
||||
throws SlickException {
|
||||
UI.enter();
|
||||
currentTab = OptionTab.DANCE;
|
||||
lastResIdx = Options.getResolutionIdx();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leave(GameContainer container, StateBasedGame game) throws SlickException {
|
||||
if (Options.wasResolutionChanged || Options.getResolutionIdx() != lastResIdx) {
|
||||
container.setForceExit(false);
|
||||
container.exit();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user