Class InputAction
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
keysKeys[]An array keyboard keys that trigger this action.
buttonsButtons[]An array of gamepad buttons that trigger this action.
Fields
OnPressed
Invoked when the action is pressed this frame.
public Action OnPressed
Field Value
OnReleased
Invoked when the action was released this frame.
public Action OnReleased
Field Value
Properties
IsDown
Gets whether this action is currently down.
public bool IsDown { get; }
Property Value
IsPressed
Gets whether the action is pressed this frame.
public bool IsPressed { get; }
Property Value
IsReleased
Gets whether this action was released this frame.
public bool IsReleased { get; }
Property Value
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
keysKeyboardStateThe current keyboard state.
lastKeysKeyboardStateThe previous frame's keyboard state.
buttonsGamePadStateThe current gamepad state.
lastButtonsGamePadStateThe previous frame's gamepad state.