Stores action-to-input bindings and helper conversions for UI and persistence.
More...
#include <InputBindings.hpp>
|
| Binding | get (Action a, BindingDevice device=BindingDevice::KeyboardMouse, std::size_t slot=0) const |
| | Return the binding assigned to an action/device/slot.
|
| void | rebind (Action a, Binding b, BindingDevice device=BindingDevice::KeyboardMouse, std::size_t slot=0) |
| | Assign a binding to an action/device/slot, clearing any duplicate action use on that device.
|
| bool | pressed (Action a, const bool *keyStates, SDL_MouseButtonFlags mouseState) const |
| | Test whether an action is currently pressed using SDL keyboard and mouse state.
|
| bool | controllerPressed (Action a, SDL_Gamepad *gamepad) const |
| | Test whether an action is currently pressed on a controller.
|
| bool | eventMatches (Action a, const SDL_Event &event, bool &down) const |
| | Match a key/button/wheel/axis SDL event against any binding for an action.
|
Stores action-to-input bindings and helper conversions for UI and persistence.
◆ BindingRow
◆ BindingTable
◆ actionFromConfigKey()
| bool InputBindings::actionFromConfigKey |
( |
std::string_view | key, |
|
|
Action & | out ) |
|
static |
◆ actionLabel()
| std::string_view InputBindings::actionLabel |
( |
Action | a | ) |
|
|
static |
Human-readable action label shown in settings UI.
◆ actions()
Return every configurable action in stable UI/config order.
◆ bindingConfigValue()
| std::string InputBindings::bindingConfigValue |
( |
Binding | b | ) |
|
|
static |
Stable TOML value for a binding.
◆ bindingFromConfigValue()
| bool InputBindings::bindingFromConfigValue |
( |
std::string_view | value, |
|
|
Binding & | out ) |
|
static |
Parse a TOML binding value.
◆ bindingLabel()
| std::string InputBindings::bindingLabel |
( |
Binding | b | ) |
|
|
static |
Human-readable binding label shown in settings UI.
◆ configKey()
| std::string_view InputBindings::configKey |
( |
Action | a | ) |
|
|
static |
Stable TOML key for an action.
◆ controllerPressed()
| bool InputBindings::controllerPressed |
( |
Action | a, |
|
|
SDL_Gamepad * | gamepad ) const |
Test whether an action is currently pressed on a controller.
◆ defaults()
Return bindings matching the game's historical default controls.
◆ eventMatches()
| bool InputBindings::eventMatches |
( |
Action | a, |
|
|
const SDL_Event & | event, |
|
|
bool & | down ) const |
Match a key/button/wheel/axis SDL event against any binding for an action.
◆ get()
Return the binding assigned to an action/device/slot.
◆ pressed()
| bool InputBindings::pressed |
( |
Action | a, |
|
|
const bool * | keyStates, |
|
|
SDL_MouseButtonFlags | mouseState ) const |
Test whether an action is currently pressed using SDL keyboard and mouse state.
◆ rebind()
Assign a binding to an action/device/slot, clearing any duplicate action use on that device.
◆ tableFor() [1/2]
◆ tableFor() [2/2]
◆ controllerBindings
Controller binding table indexed by Action and slot.
◆ kBindingSlots
| std::size_t InputBindings::kBindingSlots = 2 |
|
staticconstexpr |
◆ keyboardMouseBindings
Keyboard/mouse binding table indexed by Action and slot.
The documentation for this class was generated from the following files: