Tracks connected SDL gamepads and manages per-port ignore lists.
More...
#include <ConnectedPhysicalDeviceManager.h>
Tracks connected SDL gamepads and manages per-port ignore lists.
Maintains a live map of connected SDL gamepads. Per-port ignore lists allow a controller to be excluded from a specific port.
◆ ConnectedPhysicalDeviceManager()
| Ship::ConnectedPhysicalDeviceManager::ConnectedPhysicalDeviceManager |
( |
| ) |
|
Constructs the manager and performs an initial scan of connected gamepads.
◆ ~ConnectedPhysicalDeviceManager()
| Ship::ConnectedPhysicalDeviceManager::~ConnectedPhysicalDeviceManager |
( |
| ) |
|
◆ GetConnectedSDLGamepadNames()
| std::unordered_map< int32_t, std::string > Ship::ConnectedPhysicalDeviceManager::GetConnectedSDLGamepadNames |
( |
| ) |
|
Returns the display names of all connected SDL gamepads.
- Returns
- Map of SDL joystick instance ID to human-readable gamepad name.
◆ GetConnectedSDLGamepadsForPort()
| std::unordered_map< int32_t, SDL_Gamepad * > Ship::ConnectedPhysicalDeviceManager::GetConnectedSDLGamepadsForPort |
( |
uint8_t |
portIndex | ) |
|
Returns the connected SDL gamepads available for the given port.
Gamepads on the port's ignore list are excluded from the result.
- Parameters
-
| portIndex | Zero-based controller port index. |
- Returns
- Map of SDL joystick instance ID to SDL_Gamepad pointer.
◆ GetIgnoredInstanceIdsForPort()
| std::unordered_set< int32_t > Ship::ConnectedPhysicalDeviceManager::GetIgnoredInstanceIdsForPort |
( |
uint8_t |
portIndex | ) |
|
Returns the set of SDL joystick instance IDs ignored for a port.
- Parameters
-
| portIndex | Zero-based controller port index. |
- Returns
- Set of ignored joystick instance IDs.
◆ HandlePhysicalDeviceConnect()
| void Ship::ConnectedPhysicalDeviceManager::HandlePhysicalDeviceConnect |
( |
int32_t |
instanceId | ) |
|
Handles a gamepad-added event by refreshing the connected set.
- Parameters
-
| instanceId | Event joystick instance ID. |
◆ HandlePhysicalDeviceDisconnect()
| void Ship::ConnectedPhysicalDeviceManager::HandlePhysicalDeviceDisconnect |
( |
int32_t |
instanceId | ) |
|
Handles a gamepad-removed event by refreshing the connected set.
- Parameters
-
| instanceId | Event joystick instance ID. |
◆ IgnoreInstanceIdForPort()
| void Ship::ConnectedPhysicalDeviceManager::IgnoreInstanceIdForPort |
( |
uint8_t |
portIndex, |
|
|
int32_t |
instanceId |
|
) |
| |
Adds a joystick instance to a port's ignore list.
- Parameters
-
| portIndex | Zero-based controller port index. |
| instanceId | SDL joystick instance ID to ignore. |
◆ PortIsIgnoringInstanceId()
| bool Ship::ConnectedPhysicalDeviceManager::PortIsIgnoringInstanceId |
( |
uint8_t |
portIndex, |
|
|
int32_t |
instanceId |
|
) |
| |
Checks whether a specific joystick instance is being ignored on a port.
- Parameters
-
| portIndex | Zero-based controller port index. |
| instanceId | SDL joystick instance ID. |
- Returns
- true if the instance is ignored for the given port.
◆ RefreshConnectedSDLGamepads()
| void Ship::ConnectedPhysicalDeviceManager::RefreshConnectedSDLGamepads |
( |
| ) |
|
Re-scans SDL gamepads, preserving handles for devices that remain connected.
◆ UnignoreInstanceIdForPort()
| void Ship::ConnectedPhysicalDeviceManager::UnignoreInstanceIdForPort |
( |
uint8_t |
portIndex, |
|
|
int32_t |
instanceId |
|
) |
| |
Removes a joystick instance from a port's ignore list.
- Parameters
-
| portIndex | Zero-based controller port index. |
| instanceId | SDL joystick instance ID to stop ignoring. |
The documentation for this class was generated from the following file: