MoonWorks/src/Input/Button.cs

33 lines
710 B
C#
Raw Normal View History

2022-03-18 18:46:44 +00:00
namespace MoonWorks.Input
{
public class Button
{
public ButtonState State { get; private set; }
/// <summary>
/// True if the button is pressed or held.
/// </summary>
2022-03-18 18:46:44 +00:00
public bool IsDown => State.IsDown;
/// <summary>
/// True if the button has been continuously held for more than one frame.
/// </summary>
2022-03-18 18:46:44 +00:00
public bool IsHeld => State.IsHeld;
/// <summary>
/// True if the button was pressed this exact frame.
/// </summary>
2022-03-18 18:46:44 +00:00
public bool IsPressed => State.IsPressed;
/// <summary>
/// True if the button is not pressed.
/// </summary>
2022-03-18 18:46:44 +00:00
public bool IsReleased => State.IsReleased;
internal void Update(bool isPressed)
{
State = State.Update(isPressed);
}
}
}