mirror of https://github.com/ppy/osu
Add the ability to exit the game using escape.
This commit is contained in:
parent
b2d899feb5
commit
c5ac851ba9
|
@ -125,6 +125,15 @@ public override void Load()
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
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);
|
osuLogo.TriggerClick(state);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,5 +66,16 @@ protected override void OnSuspending(GameMode next)
|
||||||
Content.FadeOut(300);
|
Content.FadeOut(300);
|
||||||
base.OnSuspending(next);
|
base.OnSuspending(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnResuming(GameMode last)
|
||||||
|
{
|
||||||
|
//this is an exit
|
||||||
|
Game.Scheduler.AddDelayed(delegate
|
||||||
|
{
|
||||||
|
Game.Exit();
|
||||||
|
}, 300);
|
||||||
|
|
||||||
|
base.OnResuming(last);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public override void Load()
|
||||||
OnTest = delegate { Push(new TestBrowser()); },
|
OnTest = delegate { Push(new TestBrowser()); },
|
||||||
OnExit = delegate {
|
OnExit = delegate {
|
||||||
Game.Scheduler.AddDelayed(delegate {
|
Game.Scheduler.AddDelayed(delegate {
|
||||||
Game.Host.Exit();
|
Exit();
|
||||||
}, ButtonSystem.EXIT_DELAY);
|
}, ButtonSystem.EXIT_DELAY);
|
||||||
},
|
},
|
||||||
OnSettings = delegate {
|
OnSettings = delegate {
|
||||||
|
|
Loading…
Reference in New Issue