ASAPCabinetFE
 
Loading...
Searching...
No Matches
JoystickManager Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ JoystickManager()

JoystickManager::JoystickManager ( )

Constructs a JoystickManager instance.

Initializes SDL joystick support and detects connected joysticks.

◆ ~JoystickManager()

JoystickManager::~JoystickManager ( )

Destroys the JoystickManager instance.

Cleans up all open joysticks and shuts down SDL joystick support.

Member Function Documentation

◆ addJoystick()

void JoystickManager::addJoystick ( int  index)

Adds a joystick by index.

Opens the joystick at the specified index and adds it to the active list.

Parameters
indexThe index of the joystick to open.

◆ getJoysticks()

std::vector< SDL_Joystick * > JoystickManager::getJoysticks ( ) const
inline

Gets the list of active joysticks.

Returns
A vector of pointers to active SDL joysticks.

◆ removeJoystick()

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.

Parameters
idThe SDL joystick ID to remove.

The documentation for this class was generated from the following files: