Table of Contents

Class InputAction

Namespace
MonoEight.Core.UserInput
Assembly
MonoEight.Template.dll

Defines an action that can be triggered by specific keys or buttons.

public class InputAction
Inheritance
InputAction
Inherited Members

Remarks

The state properties (IsPressed, IsDown, IsReleased) return true if any of the bound keys or buttons satisfy the condition.

Constructors

InputAction(Keys[], Buttons[])

Initializes a new instance of the InputAction class.

public InputAction(Keys[] keys, Buttons[] buttons)

Parameters

keys Keys[]

An array keyboard keys that trigger this action.

buttons Buttons[]

An array of gamepad buttons that trigger this action.

Fields

OnPressed

Invoked when the action is pressed this frame.

public Action OnPressed

Field Value

Action

OnReleased

Invoked when the action was released this frame.

public Action OnReleased

Field Value

Action

Properties

IsDown

Gets whether this action is currently down.

public bool IsDown { get; }

Property Value

bool

IsPressed

Gets whether the action is pressed this frame.

public bool IsPressed { get; }

Property Value

bool

IsReleased

Gets whether this action was released this frame.

public bool IsReleased { get; }

Property Value

bool

Methods

Update(KeyboardState, KeyboardState, GamePadState, GamePadState)

Updates the internal state of the action based on the current and previous input states.

public void Update(KeyboardState keys, KeyboardState lastKeys, GamePadState buttons, GamePadState lastButtons)

Parameters

keys KeyboardState

The current keyboard state.

lastKeys KeyboardState

The previous frame's keyboard state.

buttons GamePadState

The current gamepad state.

lastButtons GamePadState

The previous frame's gamepad state.