class final
#include <engine/input/action.hpp>
InputAction Stores the state of a single input action, such as "jump" or "attack".
Can be bound to multiple key combinations, and will be considered "pressed" if any of them are pressed.
Constructors, destructors, conversion operators
- InputAction() defaulted
- Constructs without any bindings.
- InputAction(std::vector<InputCombination> combinations)
- Constructs with existing bindings.
Public functions
- auto combinations() const -> const std::vector<InputCombination>&
- Gets the bound combinations.
- auto combinations() -> std::vector<InputCombination>&
- Gets the bound combinations.
- auto pressed() const -> bool
- Checks if this action is pressed.
- auto justPressed() const -> bool
- Checks if this action was just pressed.
- auto justReleased() const -> bool
- Checks if this action was just released.
- void pressed(bool pressed)
- Sets whether this action is pressed.
- void justPressed(bool justPressed)
- Checks if this action was just pressed.
- void justReleased(bool justReleased)
- Checks if this action was just released.
Function documentation
cubos:: engine:: InputAction:: InputAction(std::vector<InputCombination> combinations)
Constructs with existing bindings.
Parameters | |
---|---|
combinations | Combinations to bind. |
const std::vector<InputCombination>& cubos:: engine:: InputAction:: combinations() const
Gets the bound combinations.
Returns | Vector of combinations. |
---|
std::vector<InputCombination>& cubos:: engine:: InputAction:: combinations()
Gets the bound combinations.
Returns | Vector of combinations. |
---|
bool cubos:: engine:: InputAction:: pressed() const
Checks if this action is pressed.
Returns | Sets whether this action is pressed. |
---|
bool cubos:: engine:: InputAction:: justPressed() const
Checks if this action was just pressed.
Returns | Sets whether this action was just pressed. |
---|
bool cubos:: engine:: InputAction:: justReleased() const
Checks if this action was just released.
Returns | Sets whether this action was just released. |
---|
void cubos:: engine:: InputAction:: pressed(bool pressed)
Sets whether this action is pressed.
Parameters | |
---|---|
pressed | New pressed state. |
void cubos:: engine:: InputAction:: justPressed(bool justPressed)
Checks if this action was just pressed.
Parameters | |
---|---|
justPressed | Whether this action was just pressed. |
void cubos:: engine:: InputAction:: justReleased(bool justReleased)
Checks if this action was just released.
Parameters | |
---|---|
justReleased | Whether this action was just released. |