2022-07-12 23:09:23 +00:00
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
|
|
namespace MoonWorks.Input
|
|
|
|
{
|
2023-09-14 18:23:04 +00:00
|
|
|
/// <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 override bool CheckPressed()
|
|
|
|
{
|
|
|
|
return Conversions.ByteToBool(Marshal.ReadByte(Parent.State, (int) KeyCode));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|