fix crashing when starting for the first time

This commit is contained in:
yugecin 2017-05-01 22:52:56 +02:00
parent eb96c49e6d
commit 32aec3ad55
2 changed files with 2 additions and 2 deletions

View File

@ -272,6 +272,7 @@ public class DisplayContainer implements ErrorDumpable, KeyListener, MouseListen
width = height = -1; width = height = -1;
Input.disableControllers(); Input.disableControllers();
Display.setTitle("opsu!dance"); Display.setTitle("opsu!dance");
OPTION_SCREEN_RESOLUTION.getListItems()[0] = nativeDisplayMode.getWidth() + "x" + nativeDisplayMode.getHeight();
updateDisplayMode(OPTION_SCREEN_RESOLUTION.getValueString()); updateDisplayMode(OPTION_SCREEN_RESOLUTION.getValueString());
Display.create(); Display.create();
GLHelper.setIcons(new String[] { "icon16.png", "icon32.png" }); GLHelper.setIcons(new String[] { "icon16.png", "icon32.png" });

View File

@ -146,7 +146,7 @@ public class Options {
public static final ToggleOption OPTION_NOSINGLEINSTANCE = new ToggleOption("-", "NoSingleInstance", "-", false); public static final ToggleOption OPTION_NOSINGLEINSTANCE = new ToggleOption("-", "NoSingleInstance", "-", false);
// in-game options // in-game options
public static final Option OPTION_SCREEN_RESOLUTION = new ListOption("Screen Resolution", "ScreenResolution", "Change the size of the game.") { public static final ListOption OPTION_SCREEN_RESOLUTION = new ListOption("Screen Resolution", "ScreenResolution", "Change the size of the game.") {
private final String[] resolutions = { private final String[] resolutions = {
null, null,
"800x600", "800x600",
@ -188,7 +188,6 @@ public class Options {
@Override @Override
public void read (String s){ public void read (String s){
resolutions[0] = displayContainer.nativeDisplayMode.getWidth() + "x" + displayContainer.nativeDisplayMode.getHeight();
try { try {
idx = Integer.parseInt(s); idx = Integer.parseInt(s);
} catch (Exception ignored) { } catch (Exception ignored) {