1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Add the ability to exit the game using escape.

This commit is contained in:
Dean Herbert 2016-10-07 18:34:37 +09:00
parent b2d899feb5
commit c5ac851ba9
3 changed files with 21 additions and 1 deletions

View File

@ -125,6 +125,15 @@ namespace osu.Game.GameModes.Menu
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (args.Key == Key.Escape)
{
if (State == MenuState.Initial)
return false;
State = MenuState.Initial;
return true;
}
osuLogo.TriggerClick(state);
return true;
}

View File

@ -66,5 +66,16 @@ namespace osu.Game.GameModes.Menu
Content.FadeOut(300);
base.OnSuspending(next);
}
protected override void OnResuming(GameMode last)
{
//this is an exit
Game.Scheduler.AddDelayed(delegate
{
Game.Exit();
}, 300);
base.OnResuming(last);
}
}
}

View File

@ -49,7 +49,7 @@ namespace osu.Game.GameModes.Menu
OnTest = delegate { Push(new TestBrowser()); },
OnExit = delegate {
Game.Scheduler.AddDelayed(delegate {
Game.Host.Exit();
Exit();
}, ButtonSystem.EXIT_DELAY);
},
OnSettings = delegate {