namespace MoonWorks.Input
{
///
/// VirtualButtons map inputs to binary inputs, like a trigger threshold or joystick axis threshold.
///
public abstract class VirtualButton
{
public ButtonState State { get; protected set; }
///
/// True if the button was pressed this exact frame.
///
public bool IsPressed => State.IsPressed;
///
/// True if the button has been continuously held for more than one frame.
///
public bool IsHeld => State.IsHeld;
///
/// True if the button is pressed or held.
///
public bool IsDown => State.IsDown;
///
/// True if the button was released this frame.
///
public bool IsReleased => State.IsReleased;
///
/// True if the button was not pressed the previous or current frame.
///
public bool IsIdle => State.IsIdle;
///
/// True if the button is idle or released.
///
public bool IsUp => State.IsUp;
internal virtual void Update()
{
State = State.Update(CheckPressed());
}
internal abstract bool CheckPressed();
}
}