From 068b40a86a62440654d48ce81b5780082f6117fc Mon Sep 17 00:00:00 2001 From: Raymonf Date: Sun, 21 Dec 2014 17:02:11 -0500 Subject: [PATCH] Mimic osu! exit button On osu!, clicking the exit button closes the game after clicking. Pressing ESC on osu! brings up the exit menu. --- src/itdelatrisu/opsu/states/MainMenu.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/itdelatrisu/opsu/states/MainMenu.java b/src/itdelatrisu/opsu/states/MainMenu.java index 302b7fbd..3c42caab 100644 --- a/src/itdelatrisu/opsu/states/MainMenu.java +++ b/src/itdelatrisu/opsu/states/MainMenu.java @@ -101,6 +101,7 @@ public class MainMenu extends BasicGameState { private float bgAlpha = 0f; // game-related variables + private GameContainer container; private StateBasedGame game; private int state; @@ -111,6 +112,7 @@ public class MainMenu extends BasicGameState { @Override public void init(GameContainer container, StateBasedGame game) throws SlickException { + this.container = container; this.game = game; osuStartTime = System.currentTimeMillis(); @@ -329,7 +331,9 @@ public class MainMenu extends BasicGameState { game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black)); } else if (exitButton.contains(x, y)) { SoundController.playSound(SoundController.SOUND_MENUHIT); - game.enterState(Opsu.STATE_MAINMENUEXIT); + Options.saveOptions(); + Opsu.closeSocket(); + container.exit(); } } }