fix changing fullscreen option not working instantly (close #131)

This commit is contained in:
yugecin 2018-10-02 22:44:54 +02:00
parent d9646a5feb
commit 21c552bd16
No known key found for this signature in database
GPG Key ID: 2C5AC035A7068E44
2 changed files with 14 additions and 6 deletions

View File

@ -372,11 +372,6 @@ public class DisplayContainer implements ErrorDumpable, SkinChangedListener {
}
public void setDisplayMode(int w, int h, boolean fullscreen) throws Exception {
if (width == w && height == h) {
Display.setFullscreen(fullscreen);
return;
}
DisplayMode displayMode = null;
if (fullscreen) {
final int bpp = this.nativeDisplayMode.getBitsPerPixel();

View File

@ -21,6 +21,7 @@ import awlex.ospu.polymover.factory.PolyMoverFactory;
import itdelatrisu.opsu.GameImage;
import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.states.Game;
import itdelatrisu.opsu.ui.Colors;
import itdelatrisu.opsu.ui.Fonts;
import org.lwjgl.input.Keyboard;
import org.newdawn.slick.SlickException;
@ -185,7 +186,19 @@ public class Options {
};
public static final ToggleOption OPTION_ALLOW_LARGER_RESOLUTIONS = new ToggleOption("Allow large resolutions", "AllowLargeRes", "Allow resolutions larger than the native resolution", false);
public static final ToggleOption OPTION_FULLSCREEN = new ToggleOption("Fullscreen Mode", "Fullscreen", "Restart to apply changes.", false);
public static final ToggleOption OPTION_FULLSCREEN = new ToggleOption("Fullscreen Mode", "Fullscreen", "Fullscreen mode", false) {
@Override
public void toggle()
{
super.toggle();
try {
displayContainer.setDisplayMode(width, height, state);
} catch (Exception e) {
bubNotifs.send(Colors.BUB_RED, "Failed to change fullscreen state");
Log.error("Failed to change fullscreen state.", e);
}
}
};
public static final ListOption OPTION_SKIN = new ListOption("Skin", "Skin", "Change how the game looks.") {
@Override