Manages SDL joystick initialization and lifecycle. More...
#include <joystick_manager.h>
Collaboration diagram for JoystickManager:Public Member Functions | |
| JoystickManager () | |
| Constructs a JoystickManager instance. | |
| ~JoystickManager () | |
| Destroys the JoystickManager instance. | |
| std::vector< SDL_Joystick * > | getJoysticks () const |
| Gets the list of active joysticks. | |
| void | addJoystick (int index) |
| Adds a joystick by index. | |
| void | removeJoystick (SDL_JoystickID id) |
| Removes a joystick by ID. | |
Manages SDL joystick initialization and lifecycle.
This class handles the initialization, addition, and removal of SDL joysticks, maintaining a list of active joysticks for input processing. It is used by input handling components, such as InputManager or KeybindManager, to process joystick events.
| JoystickManager::JoystickManager | ( | ) |
Constructs a JoystickManager instance.
Initializes SDL joystick support and detects connected joysticks.
| JoystickManager::~JoystickManager | ( | ) |
Destroys the JoystickManager instance.
Cleans up all open joysticks and shuts down SDL joystick support.
| void JoystickManager::addJoystick | ( | int | index | ) |
Adds a joystick by index.
Opens the joystick at the specified index and adds it to the active list.
| index | The index of the joystick to open. |
|
inline |
Gets the list of active joysticks.
| void JoystickManager::removeJoystick | ( | SDL_JoystickID | id | ) |
Removes a joystick by ID.
Closes the joystick with the specified ID and removes it from the active list.
| id | The SDL joystick ID to remove. |