2017-02-07 12:59:30 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2016-10-07 23:43:06 +08:00
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Input;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Input
|
|
|
|
|
{
|
|
|
|
|
public class GlobalHotkeys : Drawable
|
|
|
|
|
{
|
|
|
|
|
public Func<InputState, KeyDownEventArgs, bool> Handler;
|
|
|
|
|
|
|
|
|
|
public override bool HandleInput => true;
|
|
|
|
|
|
2017-02-20 14:27:48 +08:00
|
|
|
|
public GlobalHotkeys()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-07 23:43:06 +08:00
|
|
|
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
return Handler(state, args);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|