MoonWorks/src/Input/VirtualButtons/KeyboardButton.cs

23 lines
463 B
C#
Raw Normal View History

2022-07-12 23:09:23 +00:00
namespace MoonWorks.Input
{
/// <summary>
/// A virtual button corresponding to a keyboard button.
/// </summary>
2022-07-12 23:09:23 +00:00
public class KeyboardButton : VirtualButton
{
Keyboard Parent;
2023-06-09 23:17:41 +00:00
public KeyCode KeyCode { get; }
2022-07-12 23:09:23 +00:00
internal KeyboardButton(Keyboard parent, KeyCode keyCode)
{
Parent = parent;
KeyCode = keyCode;
}
internal unsafe override bool CheckPressed()
2022-07-12 23:09:23 +00:00
{
return Conversions.ByteToBool(((byte*) Parent.State)[(int) KeyCode]);
2022-07-12 23:09:23 +00:00
}
}
}