Add shortcut to go home

This commit is contained in:
Joehu 2020-06-14 11:22:38 -07:00
parent a8e83c5be5
commit b8fa1a2c41
2 changed files with 23 additions and 1 deletions

View File

@ -39,6 +39,8 @@ public GlobalActionContainer(OsuGameBase game)
new KeyBinding(InputKey.Escape, GlobalAction.Back),
new KeyBinding(InputKey.ExtraMouseButton1, GlobalAction.Back),
new KeyBinding(new[] { InputKey.Alt, InputKey.Home }, GlobalAction.Home),
new KeyBinding(InputKey.Up, GlobalAction.SelectPrevious),
new KeyBinding(InputKey.Down, GlobalAction.SelectNext),
@ -152,5 +154,8 @@ public enum GlobalAction
[Description("Next Selection")]
SelectNext,
[Description("Home")]
Home,
}
}

View File

@ -2,10 +2,12 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Game.Input.Bindings;
namespace osu.Game.Overlays.Toolbar
{
public class ToolbarHomeButton : ToolbarButton
public class ToolbarHomeButton : ToolbarButton, IKeyBindingHandler<GlobalAction>
{
public ToolbarHomeButton()
{
@ -13,5 +15,20 @@ public ToolbarHomeButton()
TooltipMain = "Home";
TooltipSub = "Return to the main menu";
}
public bool OnPressed(GlobalAction action)
{
if (action == GlobalAction.Home)
{
Click();
return true;
}
return false;
}
public void OnReleased(GlobalAction action)
{
}
}
}