Interface for keybind providers (forward declaration). More...
#include <screenshot_manager.h>
Public Member Functions | |
virtual | ~IKeybindProvider ()=default |
Virtual destructor for proper cleanup of derived classes. | |
virtual std::string | getActionForKey (const std::string &key) const =0 |
virtual SDL_Keycode | getKey (const std::string &action) const =0 |
Gets the keyboard keycode for an action. | |
virtual void | setKey (const std::string &action, SDL_Keycode key)=0 |
Sets the keyboard keycode for an action. | |
virtual std::vector< std::string > | getActions () const =0 |
Gets the list of supported actions. | |
virtual void | setJoystickButton (const std::string &action, int joystickId, uint8_t button)=0 |
Sets a joystick button binding for an action. | |
virtual void | setJoystickHat (const std::string &action, int joystickId, uint8_t hat, uint8_t direction)=0 |
Sets a joystick hat binding for an action. | |
virtual void | setJoystickAxis (const std::string &action, int joystickId, uint8_t axis, bool positiveDirection)=0 |
Sets a joystick axis binding for an action. | |
virtual std::string | eventToString (const SDL_Event &event) const =0 |
Converts an SDL event to a string representation. | |
virtual bool | isAction (const SDL_KeyboardEvent &event, const std::string &action) const =0 |
Checks if a keyboard event matches an action. | |
virtual bool | isJoystickAction (const SDL_JoyButtonEvent &event, const std::string &action) const =0 |
Checks if a joystick button event matches an action. | |
virtual bool | isJoystickHatAction (const SDL_JoyHatEvent &event, const std::string &action) const =0 |
Checks if a joystick hat event matches an action. | |
virtual bool | isJoystickAxisAction (const SDL_JoyAxisEvent &event, const std::string &action) const =0 |
Checks if a joystick axis event matches an action. | |
virtual void | loadKeybinds (const std::map< std::string, std::string > &keybindData)=0 |
Loads keybind configurations from a data map. | |
virtual void | saveKeybinds (std::map< std::string, std::string > &keybinds) const =0 |
Saves keybind configurations to a map. | |
Interface for keybind providers (forward declaration).
Interface for managing keyboard and joystick input bindings.
This pure virtual class defines methods for retrieving, setting, and validating input bindings for application actions, including keyboard keys, joystick buttons, hats, and axes. It also provides utilities for converting events to strings and managing keybind persistence.
|
pure virtual |
Converts an SDL event to a string representation.
Generates a human-readable string describing the input event (key, button, hat, or axis).
event | The SDL event to convert. |
Implemented in KeybindManager.
|
pure virtual |
Gets the list of supported actions.
Returns a vector of action identifiers that can be bound to inputs.
Implemented in KeybindManager.
|
pure virtual |
Gets the keyboard keycode for an action.
Retrieves the SDL keycode associated with the specified action.
action | The action identifier (e.g., "LaunchTable"). |
Implemented in KeybindManager.
|
pure virtual |
Checks if a keyboard event matches an action.
Determines if the keyboard event corresponds to the specified action's keybinding.
event | The SDL keyboard event. |
action | The action identifier. |
Implemented in KeybindManager.
|
pure virtual |
Checks if a joystick button event matches an action.
Determines if the joystick button event corresponds to the specified action's binding.
event | The SDL joystick button event. |
action | The action identifier. |
Implemented in KeybindManager.
|
pure virtual |
Checks if a joystick axis event matches an action.
Determines if the joystick axis event corresponds to the specified action's binding.
event | The SDL joystick axis event. |
action | The action identifier. |
Implemented in KeybindManager.
|
pure virtual |
Checks if a joystick hat event matches an action.
Determines if the joystick hat event corresponds to the specified action's binding.
event | The SDL joystick hat event. |
action | The action identifier. |
Implemented in KeybindManager.
|
pure virtual |
Loads keybind configurations from a data map.
Populates the keybind mappings from a provided map of action-to-input strings.
keybindData | A map of action identifiers to input configuration strings. |
Implemented in KeybindManager.
|
pure virtual |
Saves keybind configurations to a map.
Populates a map with the current keybind mappings for JSON serialization.
keybinds | The map to populate with action-to-input string pairs. |
Implemented in KeybindManager.
|
pure virtual |
Sets a joystick axis binding for an action.
Assigns a joystick axis direction to the specified action.
action | The action identifier. |
joystickId | The ID of the joystick. |
axis | The joystick axis index. |
positiveDirection | True for positive axis direction, false for negative. |
Implemented in KeybindManager.
|
pure virtual |
Sets a joystick button binding for an action.
Assigns a joystick button to the specified action.
action | The action identifier. |
joystickId | The ID of the joystick. |
button | The joystick button index. |
Implemented in KeybindManager.
|
pure virtual |
Sets a joystick hat binding for an action.
Assigns a joystick hat direction to the specified action.
action | The action identifier. |
joystickId | The ID of the joystick. |
hat | The joystick hat index. |
direction | The hat direction (e.g., SDL_HAT_UP). |
Implemented in KeybindManager.
|
pure virtual |
Sets the keyboard keycode for an action.
Assigns a new SDL keycode to the specified action.
action | The action identifier. |
key | The SDL keycode to assign. |
Implemented in KeybindManager.