add fullscreen option, close #17
This commit is contained in:
parent
3d3296f4ff
commit
b1887b953b
|
@ -302,7 +302,7 @@ public class Options {
|
||||||
} catch (IllegalArgumentException ignored) {}
|
} catch (IllegalArgumentException ignored) {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// FULLSCREEN ("Fullscreen Mode", "Fullscreen", "Restart to apply changes.", false),
|
FULLSCREEN ("Fullscreen Mode", "Fullscreen", "Restart to apply changes.", false),
|
||||||
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; }
|
||||||
|
@ -1457,6 +1457,7 @@ public class Options {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
app.setDisplayMode(resolution.getWidth(), resolution.getHeight(), false);
|
app.setDisplayMode(resolution.getWidth(), resolution.getHeight(), false);
|
||||||
|
app.setFullscreen(isFullscreen());
|
||||||
} catch (SlickException e) {
|
} catch (SlickException e) {
|
||||||
ErrorHandler.error("Failed to set display mode.", e, true);
|
ErrorHandler.error("Failed to set display mode.", e, true);
|
||||||
}
|
}
|
||||||
|
@ -1464,16 +1465,18 @@ public class Options {
|
||||||
width = resolution.width;
|
width = resolution.width;
|
||||||
height = resolution.height;
|
height = resolution.height;
|
||||||
|
|
||||||
|
if (!isFullscreen()) {
|
||||||
// set borderless window if dimensions match screen size
|
// set borderless window if dimensions match screen size
|
||||||
boolean borderless = (screenWidth == resolution.getWidth() && screenHeight == resolution.getHeight());
|
boolean borderless = (screenWidth == resolution.getWidth() && screenHeight == resolution.getHeight());
|
||||||
System.setProperty("org.lwjgl.opengl.Window.undecorated", Boolean.toString(borderless));
|
System.setProperty("org.lwjgl.opengl.Window.undecorated", Boolean.toString(borderless));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
/**
|
||||||
// * Returns whether or not fullscreen mode is enabled.
|
* Returns whether or not fullscreen mode is enabled.
|
||||||
// * @return true if enabled
|
* @return true if enabled
|
||||||
// */
|
*/
|
||||||
// public static boolean isFullscreen() { return fullscreen; }
|
public static boolean isFullscreen() { return GameOption.FULLSCREEN.getBooleanValue(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether or not the FPS counter display is enabled.
|
* Returns whether or not the FPS counter display is enabled.
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class OptionsMenu extends BasicGameState {
|
||||||
private enum OptionTab {
|
private enum OptionTab {
|
||||||
DISPLAY ("Display", new GameOption[] {
|
DISPLAY ("Display", new GameOption[] {
|
||||||
GameOption.SCREEN_RESOLUTION,
|
GameOption.SCREEN_RESOLUTION,
|
||||||
// GameOption.FULLSCREEN,
|
GameOption.FULLSCREEN,
|
||||||
GameOption.SKIN,
|
GameOption.SKIN,
|
||||||
GameOption.TARGET_FPS,
|
GameOption.TARGET_FPS,
|
||||||
GameOption.SHOW_FPS,
|
GameOption.SHOW_FPS,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user