SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_gamepad.h
1#ifndef SDL3PP_GAMEPAD_H_
2#define SDL3PP_GAMEPAD_H_
3
4#include <SDL3/SDL_gamepad.h>
5#include "SDL3pp_error.h"
6#include "SDL3pp_guid.h"
7#include "SDL3pp_iostream.h"
8#include "SDL3pp_joystick.h"
9#include "SDL3pp_power.h"
10#include "SDL3pp_properties.h"
11#include "SDL3pp_sensor.h"
12#include "SDL3pp_stdinc.h"
13
14namespace SDL {
15
70
71// Forward decl
72struct GamepadBase;
73
74// Forward decl
75struct Gamepad;
76
78using GamepadRaw = SDL_Gamepad*;
79
86
96using GamepadType = SDL_GamepadType;
97
99 SDL_GAMEPAD_TYPE_UNKNOWN;
100
102 SDL_GAMEPAD_TYPE_STANDARD;
103
105 SDL_GAMEPAD_TYPE_XBOX360;
106
108 SDL_GAMEPAD_TYPE_XBOXONE;
109
111 SDL_GAMEPAD_TYPE_PS3;
112
114 SDL_GAMEPAD_TYPE_PS4;
115
117 SDL_GAMEPAD_TYPE_PS5;
118
120 SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO;
121
123 SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT;
124
126 SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
127
129 SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR;
130
131#if SDL_VERSION_ATLEAST(3, 4, 0)
132
134 SDL_GAMEPAD_TYPE_GAMECUBE;
135
136#endif // SDL_VERSION_ATLEAST(3, 4, 0)
137
138#if SDL_VERSION_ATLEAST(3, 4, 18)
139
141 SDL_GAMEPAD_TYPE_STEAM;
142
143#endif // SDL_VERSION_ATLEAST(3, 4, 18)
144
146 SDL_GAMEPAD_TYPE_COUNT;
147
171using GamepadButton = SDL_GamepadButton;
172
174 SDL_GAMEPAD_BUTTON_INVALID;
175
177 SDL_GAMEPAD_BUTTON_SOUTH;
178
180 SDL_GAMEPAD_BUTTON_EAST;
181
183 SDL_GAMEPAD_BUTTON_WEST;
184
186 SDL_GAMEPAD_BUTTON_NORTH;
187
189 SDL_GAMEPAD_BUTTON_BACK;
190
192 SDL_GAMEPAD_BUTTON_GUIDE;
193
195 SDL_GAMEPAD_BUTTON_START;
196
198 SDL_GAMEPAD_BUTTON_LEFT_STICK;
199
201 SDL_GAMEPAD_BUTTON_RIGHT_STICK;
202
204 SDL_GAMEPAD_BUTTON_LEFT_SHOULDER;
205
207 SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER;
208
210 SDL_GAMEPAD_BUTTON_DPAD_UP;
211
213 SDL_GAMEPAD_BUTTON_DPAD_DOWN;
214
216 SDL_GAMEPAD_BUTTON_DPAD_LEFT;
217
219 SDL_GAMEPAD_BUTTON_DPAD_RIGHT;
220
226constexpr GamepadButton GAMEPAD_BUTTON_MISC1 = SDL_GAMEPAD_BUTTON_MISC1;
227
234 SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1;
235
241 SDL_GAMEPAD_BUTTON_LEFT_PADDLE1;
242
249 SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2;
250
257 SDL_GAMEPAD_BUTTON_LEFT_PADDLE2;
258
260 SDL_GAMEPAD_BUTTON_TOUCHPAD;
261
263 SDL_GAMEPAD_BUTTON_MISC2;
264
266constexpr GamepadButton GAMEPAD_BUTTON_MISC3 = SDL_GAMEPAD_BUTTON_MISC3;
267
269constexpr GamepadButton GAMEPAD_BUTTON_MISC4 = SDL_GAMEPAD_BUTTON_MISC4;
270
272 SDL_GAMEPAD_BUTTON_MISC5;
273
275 SDL_GAMEPAD_BUTTON_MISC6;
276
278 SDL_GAMEPAD_BUTTON_COUNT;
279
291using GamepadButtonLabel = SDL_GamepadButtonLabel;
292
294 SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN;
295
297 SDL_GAMEPAD_BUTTON_LABEL_A;
298
300 SDL_GAMEPAD_BUTTON_LABEL_B;
301
303 SDL_GAMEPAD_BUTTON_LABEL_X;
304
306 SDL_GAMEPAD_BUTTON_LABEL_Y;
307
309 SDL_GAMEPAD_BUTTON_LABEL_CROSS;
310
312 SDL_GAMEPAD_BUTTON_LABEL_CIRCLE;
313
315 SDL_GAMEPAD_BUTTON_LABEL_SQUARE;
316
318 SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE;
319
333using GamepadAxis = SDL_GamepadAxis;
334
336 SDL_GAMEPAD_AXIS_INVALID;
337
339 SDL_GAMEPAD_AXIS_LEFTX;
340
342 SDL_GAMEPAD_AXIS_LEFTY;
343
345 SDL_GAMEPAD_AXIS_RIGHTX;
346
348 SDL_GAMEPAD_AXIS_RIGHTY;
349
351 SDL_GAMEPAD_AXIS_LEFT_TRIGGER;
352
354 SDL_GAMEPAD_AXIS_RIGHT_TRIGGER;
355
357 SDL_GAMEPAD_AXIS_COUNT;
358
369using GamepadBindingType = SDL_GamepadBindingType;
370
372 SDL_GAMEPAD_BINDTYPE_NONE;
373
375 SDL_GAMEPAD_BINDTYPE_BUTTON;
376
378 SDL_GAMEPAD_BINDTYPE_AXIS;
379
381 SDL_GAMEPAD_BINDTYPE_HAT;
382
398using GamepadBinding = SDL_GamepadBinding;
399
405struct GamepadBase : ResourceBaseT<GamepadRaw>
406{
408
418 void Close();
419
438
465
477
490 const char* GetName();
491
504 const char* GetPath();
505
518
531
545 int GetPlayerIndex();
546
560 void SetPlayerIndex(int player_index);
561
576
591
606
619
632 const char* GetSerial();
633
647
659
679 PowerState GetPowerInfo(int* percent);
680
691 bool Connected();
692
713
726
743 bool HasAxis(GamepadAxis axis);
744
771
787 bool HasButton(GamepadButton button);
788
802 bool GetButton(GamepadButton button);
803
817
829 int GetNumTouchpads();
830
845 int GetNumTouchpadFingers(int touchpad);
846
867 void GetTouchpadFinger(int touchpad,
868 int finger,
869 bool* down,
870 float* x,
871 float* y,
872 float* pressure);
873
888 bool HasSensor(SensorType type);
889
904 void SetSensorEnabled(SensorType type, bool enabled);
905
918 bool SensorEnabled(SensorType type);
919
930 float GetSensorDataRate(SensorType type);
931
947 void GetSensorData(SensorType type, float* data, int num_values);
948
969 void Rumble(Uint16 low_frequency_rumble,
970 Uint16 high_frequency_rumble,
971 Uint32 duration_ms);
972
999 void RumbleTriggers(Uint16 left_rumble,
1000 Uint16 right_rumble,
1001 Uint32 duration_ms);
1002
1021 void SetLED(Uint8 red, Uint8 green, Uint8 blue);
1022
1034 void SendEffect(const void* data, int size);
1035
1050
1063 const char* GetAppleSFSymbolsNameForAxis(GamepadAxis axis);
1064};
1065
1074{
1075 using GamepadBase::GamepadBase;
1076
1084 constexpr explicit Gamepad(GamepadRaw resource) noexcept
1085 : GamepadBase(resource)
1086 {
1087 }
1088
1090 constexpr Gamepad(Gamepad&& other) noexcept
1091 : Gamepad(other.release())
1092 {
1093 }
1094
1109 Gamepad(JoystickID instance_id);
1110
1112 ~Gamepad() { SDL_CloseGamepad(get()); }
1113
1115 constexpr Gamepad& operator=(Gamepad&& other) noexcept
1116 {
1117 swap(*this, other);
1118 return *this;
1119 }
1120};
1121
1165{
1166 return SDL_AddGamepadMapping(mapping);
1167}
1168
1207inline int AddGamepadMappingsFromIO(IOStreamRef src, bool closeio)
1208{
1209 return SDL_AddGamepadMappingsFromIO(src, closeio);
1210}
1211
1245{
1246 return SDL_AddGamepadMappingsFromFile(file);
1247}
1248
1260inline void ReloadGamepadMappings() { CheckError(SDL_ReloadGamepadMappings()); }
1261
1273{
1274 int count;
1275 auto data = CheckError(SDL_GetGamepadMappings(&count));
1276 return OwnArray<char*>(data);
1277}
1278
1294{
1295 return StringResult(SDL_GetGamepadMappingForGUID(guid));
1296}
1297
1317{
1318 return StringResult(SDL_GetGamepadMapping(gamepad));
1319}
1320
1325
1343inline void SetGamepadMapping(JoystickID instance_id, StringParam mapping)
1344{
1345 CheckError(SDL_SetGamepadMapping(instance_id, mapping));
1346}
1347
1359inline bool HasGamepad() { return SDL_HasGamepad(); }
1360
1375{
1376 int count;
1377 auto r = reinterpret_cast<JoystickID*>(SDL_GetGamepads(&count));
1378 return OwnArray<JoystickID>(r, count);
1379}
1380
1395inline bool IsGamepad(JoystickID instance_id)
1396{
1397 return SDL_IsGamepad(instance_id);
1398}
1399
1416inline const char* GetGamepadNameForID(JoystickID instance_id)
1417{
1418 return SDL_GetGamepadNameForID(instance_id);
1419}
1420
1437inline const char* GetGamepadPathForID(JoystickID instance_id)
1438{
1439 return SDL_GetGamepadPathForID(instance_id);
1440}
1441
1458{
1459 return SDL_GetGamepadPlayerIndexForID(instance_id);
1460}
1461
1479{
1480 return SDL_GetGamepadGUIDForID(instance_id);
1481}
1482
1501{
1502 return SDL_GetGamepadVendorForID(instance_id);
1503}
1504
1523{
1524 return SDL_GetGamepadProductForID(instance_id);
1525}
1526
1545{
1546 return SDL_GetGamepadProductVersionForID(instance_id);
1547}
1548
1566{
1567 return SDL_GetGamepadTypeForID(instance_id);
1568}
1569
1587{
1588 return SDL_GetRealGamepadTypeForID(instance_id);
1589}
1590
1607inline char* GetGamepadMappingForID(JoystickID instance_id)
1608{
1609 return SDL_GetGamepadMappingForID(instance_id);
1610}
1611
1626inline Gamepad OpenGamepad(JoystickID instance_id)
1627{
1628 return Gamepad(instance_id);
1629}
1630
1631inline Gamepad::Gamepad(JoystickID instance_id)
1632 : Gamepad(SDL_OpenGamepad(instance_id))
1633{
1634}
1635
1649{
1650 return {CheckError(SDL_GetGamepadFromID(instance_id))};
1651}
1652
1667{
1668 return {SDL_GetGamepadFromPlayerIndex(player_index)};
1669}
1670
1697{
1698 return {CheckError(SDL_GetGamepadProperties(gamepad))};
1699}
1700
1705
1717
1718constexpr auto MONO_LED_BOOLEAN =
1719 SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN;
1720
1721constexpr auto RGB_LED_BOOLEAN =
1722 SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN;
1723
1724constexpr auto PLAYER_LED_BOOLEAN =
1725 SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN;
1726
1727constexpr auto RUMBLE_BOOLEAN =
1728 SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN;
1729
1731 SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN;
1732
1733} // namespace prop::GamepadCap
1734
1747{
1748 return CheckError(SDL_GetGamepadID(gamepad));
1749}
1750
1752
1766inline const char* GetGamepadName(GamepadRef gamepad)
1767{
1768 return SDL_GetGamepadName(gamepad);
1769}
1770
1771inline const char* GamepadBase::GetName() { return SDL::GetGamepadName(get()); }
1772
1786inline const char* GetGamepadPath(GamepadRef gamepad)
1787{
1788 return SDL_GetGamepadPath(gamepad);
1789}
1790
1791inline const char* GamepadBase::GetPath() { return SDL::GetGamepadPath(get()); }
1792
1806{
1807 return SDL_GetGamepadType(gamepad);
1808}
1809
1811
1825{
1826 return SDL_GetRealGamepadType(gamepad);
1827}
1828
1833
1849{
1850 return SDL_GetGamepadPlayerIndex(gamepad);
1851}
1852
1854{
1856}
1857
1872inline void SetGamepadPlayerIndex(GamepadRef gamepad, int player_index)
1873{
1874 CheckError(SDL_SetGamepadPlayerIndex(gamepad, player_index));
1875}
1876
1877inline void GamepadBase::SetPlayerIndex(int player_index)
1878{
1879 SDL::SetGamepadPlayerIndex(get(), player_index);
1880}
1881
1897{
1898 return SDL_GetGamepadVendor(gamepad);
1899}
1900
1902
1918{
1919 return SDL_GetGamepadProduct(gamepad);
1920}
1921
1923{
1924 return SDL::GetGamepadProduct(get());
1925}
1926
1942{
1943 return SDL_GetGamepadProductVersion(gamepad);
1944}
1945
1950
1964{
1965 return SDL_GetGamepadFirmwareVersion(gamepad);
1966}
1967
1972
1985inline const char* GetGamepadSerial(GamepadRef gamepad)
1986{
1987 return SDL_GetGamepadSerial(gamepad);
1988}
1989
1990inline const char* GamepadBase::GetSerial()
1991{
1992 return SDL::GetGamepadSerial(get());
1993}
1994
2009{
2010 return SDL_GetGamepadSteamHandle(gamepad);
2011}
2012
2017
2030{
2031 return CheckError(SDL_GetGamepadConnectionState(gamepad));
2032}
2033
2038
2058inline PowerState GetGamepadPowerInfo(GamepadRef gamepad, int* percent)
2059{
2060 return SDL_GetGamepadPowerInfo(gamepad, percent);
2061}
2062
2064{
2065 return SDL::GetGamepadPowerInfo(get(), percent);
2066}
2067
2079inline bool GamepadConnected(GamepadRef gamepad)
2080{
2081 return SDL_GamepadConnected(gamepad);
2082}
2083
2085
2107{
2108 return CheckError(SDL_GetGamepadJoystick(gamepad));
2109}
2110
2115
2131inline void SetGamepadEventsEnabled(bool enabled)
2132{
2133 SDL_SetGamepadEventsEnabled(enabled);
2134}
2135
2150inline bool GamepadEventsEnabled() { return SDL_GamepadEventsEnabled(); }
2151
2164{
2165 int count;
2166 auto r = (SDL_GetGamepadBindings(gamepad, &count));
2167 return OwnArray<GamepadBinding*>(r, count);
2168}
2169
2174
2186inline void UpdateGamepads() { SDL_UpdateGamepads(); }
2187
2207{
2208 return SDL_GetGamepadTypeFromString(str);
2209}
2210
2225inline const char* GetGamepadStringForType(GamepadType type)
2226{
2227 return SDL_GetGamepadStringForType(type);
2228}
2229
2252{
2253 return SDL_GetGamepadAxisFromString(str);
2254}
2255
2270inline const char* GetGamepadStringForAxis(GamepadAxis axis)
2271{
2272 return SDL_GetGamepadStringForAxis(axis);
2273}
2274
2292inline bool GamepadHasAxis(GamepadRef gamepad, GamepadAxis axis)
2293{
2294 return SDL_GamepadHasAxis(gamepad, axis);
2295}
2296
2298{
2299 return SDL::GamepadHasAxis(get(), axis);
2300}
2301
2329{
2330 return SDL_GetGamepadAxis(gamepad, axis);
2331}
2332
2334{
2335 return SDL::GetGamepadAxis(get(), axis);
2336}
2337
2357{
2358 return SDL_GetGamepadButtonFromString(str);
2359}
2360
2376{
2377 return SDL_GetGamepadStringForButton(button);
2378}
2379
2396inline bool GamepadHasButton(GamepadRef gamepad, GamepadButton button)
2397{
2398 return SDL_GamepadHasButton(gamepad, button);
2399}
2400
2402{
2403 return SDL::GamepadHasButton(get(), button);
2404}
2405
2420inline bool GetGamepadButton(GamepadRef gamepad, GamepadButton button)
2421{
2422 return SDL_GetGamepadButton(gamepad, button);
2423}
2424
2426{
2427 return SDL::GetGamepadButton(get(), button);
2428}
2429
2444 GamepadButton button)
2445{
2446 return SDL_GetGamepadButtonLabelForType(type, button);
2447}
2448
2463 GamepadButton button)
2464{
2465 return SDL_GetGamepadButtonLabel(gamepad, button);
2466}
2467
2472
2486{
2487 return SDL_GetNumGamepadTouchpads(gamepad);
2488}
2489
2491{
2493}
2494
2510inline int GetNumGamepadTouchpadFingers(GamepadRef gamepad, int touchpad)
2511{
2512 return SDL_GetNumGamepadTouchpadFingers(gamepad, touchpad);
2513}
2514
2516{
2517 return SDL::GetNumGamepadTouchpadFingers(get(), touchpad);
2518}
2519
2542 int touchpad,
2543 int finger,
2544 bool* down,
2545 float* x,
2546 float* y,
2547 float* pressure)
2548{
2549 CheckError(SDL_GetGamepadTouchpadFinger(
2550 gamepad, touchpad, finger, down, x, y, pressure));
2551}
2552
2553inline void GamepadBase::GetTouchpadFinger(int touchpad,
2554 int finger,
2555 bool* down,
2556 float* x,
2557 float* y,
2558 float* pressure)
2559{
2560 SDL::GetGamepadTouchpadFinger(get(), touchpad, finger, down, x, y, pressure);
2561}
2562
2578inline bool GamepadHasSensor(GamepadRef gamepad, SensorType type)
2579{
2580 return SDL_GamepadHasSensor(gamepad, type);
2581}
2582
2584{
2585 return SDL::GamepadHasSensor(get(), type);
2586}
2587
2604 SensorType type,
2605 bool enabled)
2606{
2607 CheckError(SDL_SetGamepadSensorEnabled(gamepad, type, enabled));
2608}
2609
2610inline void GamepadBase::SetSensorEnabled(SensorType type, bool enabled)
2611{
2612 SDL::SetGamepadSensorEnabled(get(), type, enabled);
2613}
2614
2629{
2630 return SDL_GamepadSensorEnabled(gamepad, type);
2631}
2632
2634{
2635 return SDL::GamepadSensorEnabled(get(), type);
2636}
2637
2650{
2651 return SDL_GetGamepadSensorDataRate(gamepad, type);
2652}
2653
2655{
2656 return SDL::GetGamepadSensorDataRate(get(), type);
2657}
2658
2676 SensorType type,
2677 float* data,
2678 int num_values)
2679{
2680 CheckError(SDL_GetGamepadSensorData(gamepad, type, data, num_values));
2681}
2682
2684 float* data,
2685 int num_values)
2686{
2687 SDL::GetGamepadSensorData(get(), type, data, num_values);
2688}
2689
2711inline void RumbleGamepad(GamepadRef gamepad,
2712 Uint16 low_frequency_rumble,
2713 Uint16 high_frequency_rumble,
2714 Uint32 duration_ms)
2715{
2716 CheckError(SDL_RumbleGamepad(
2717 gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms));
2718}
2719
2720inline void GamepadBase::Rumble(Uint16 low_frequency_rumble,
2721 Uint16 high_frequency_rumble,
2722 Uint32 duration_ms)
2723{
2725 get(), low_frequency_rumble, high_frequency_rumble, duration_ms);
2726}
2727
2756 Uint16 left_rumble,
2757 Uint16 right_rumble,
2758 Uint32 duration_ms)
2759{
2760 CheckError(
2761 SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms));
2762}
2763
2764inline void GamepadBase::RumbleTriggers(Uint16 left_rumble,
2765 Uint16 right_rumble,
2766 Uint32 duration_ms)
2767{
2768 SDL::RumbleGamepadTriggers(get(), left_rumble, right_rumble, duration_ms);
2769}
2770
2790inline void SetGamepadLED(GamepadRef gamepad,
2791 Uint8 red,
2792 Uint8 green,
2793 Uint8 blue)
2794{
2795 CheckError(SDL_SetGamepadLED(gamepad, red, green, blue));
2796}
2797
2798inline void GamepadBase::SetLED(Uint8 red, Uint8 green, Uint8 blue)
2799{
2800 SDL::SetGamepadLED(get(), red, green, blue);
2801}
2802
2815inline void SendGamepadEffect(GamepadRef gamepad, const void* data, int size)
2816{
2817 CheckError(SDL_SendGamepadEffect(gamepad, data, size));
2818}
2819
2820inline void GamepadBase::SendEffect(const void* data, int size)
2821{
2822 SDL::SendGamepadEffect(get(), data, size);
2823}
2824
2836inline void CloseGamepad(GamepadRaw gamepad) { SDL_CloseGamepad(gamepad); }
2837
2839
2854 GamepadButton button)
2855{
2856 return SDL_GetGamepadAppleSFSymbolsNameForButton(gamepad, button);
2857}
2858
2860 GamepadButton button)
2861{
2863}
2864
2879 GamepadAxis axis)
2880{
2881 return SDL_GetGamepadAppleSFSymbolsNameForAxis(gamepad, axis);
2882}
2883
2888
2890
2891} // namespace SDL
2892
2893#endif /* SDL3PP_GAMEPAD_H_ */
This is a unique ID for a joystick for the time it is connected to the system, and is never reused fo...
Definition SDL3pp_joystick.h:144
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:44
constexpr OwnArray(std::nullptr_t=nullptr)
Constructor.
Definition SDL3pp_ownPtr.h:50
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:57
friend constexpr void swap(ResourceBaseT &lhs, ResourceBaseT &rhs) noexcept
Definition SDL3pp_resource.h:65
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:54
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:58
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:199
constexpr GamepadType GAMEPAD_TYPE_STEAM
GAMEPAD_TYPE_STEAM.
Definition SDL3pp_gamepad.h:140
Uint64 GetGamepadSteamHandle(GamepadRef gamepad)
Get the Steam Input handle of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:2008
constexpr GamepadButton GAMEPAD_BUTTON_MISC6
Additional button.
Definition SDL3pp_gamepad.h:274
const char * GetAppleSFSymbolsNameForAxis(GamepadAxis axis)
Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2884
int GetNumTouchpads()
Get the number of touchpads on a gamepad.
Definition SDL3pp_gamepad.h:2490
JoystickConnectionState GetConnectionState()
Get the connection state of a gamepad.
Definition SDL3pp_gamepad.h:2034
void SetSensorEnabled(SensorType type, bool enabled)
Set whether data reporting for a gamepad sensor is enabled.
Definition SDL3pp_gamepad.h:2610
void RumbleTriggers(Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms)
Start a rumble effect in the gamepad's triggers.
Definition SDL3pp_gamepad.h:2764
constexpr GamepadBindingType GAMEPAD_BINDTYPE_AXIS
GAMEPAD_BINDTYPE_AXIS.
Definition SDL3pp_gamepad.h:377
int GetNumGamepadTouchpadFingers(GamepadRef gamepad, int touchpad)
Get the number of supported simultaneous fingers on a touchpad on a game gamepad.
Definition SDL3pp_gamepad.h:2510
int AddGamepadMappingsFromFile(StringParam file)
Load a set of gamepad mappings from a file.
Definition SDL3pp_gamepad.h:1244
constexpr GamepadType GAMEPAD_TYPE_NINTENDO_SWITCH_PRO
GAMEPAD_TYPE_NINTENDO_SWITCH_PRO.
Definition SDL3pp_gamepad.h:119
constexpr GamepadType GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT
GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT.
Definition SDL3pp_gamepad.h:122
const char * GetGamepadName(GamepadRef gamepad)
Get the implementation-dependent name for an opened gamepad.
Definition SDL3pp_gamepad.h:1766
GamepadType GetType()
Get the type of an opened gamepad.
Definition SDL3pp_gamepad.h:1810
Uint16 GetProduct()
Get the USB product ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1922
bool GamepadHasButton(GamepadRef gamepad, GamepadButton button)
Query whether a gamepad has a given button.
Definition SDL3pp_gamepad.h:2396
bool GamepadHasSensor(GamepadRef gamepad, SensorType type)
Return whether a gamepad has a particular sensor.
Definition SDL3pp_gamepad.h:2578
bool HasSensor(SensorType type)
Return whether a gamepad has a particular sensor.
Definition SDL3pp_gamepad.h:2583
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_SQUARE
GAMEPAD_BUTTON_LABEL_SQUARE.
Definition SDL3pp_gamepad.h:314
constexpr GamepadAxis GAMEPAD_AXIS_RIGHTX
GAMEPAD_AXIS_RIGHTX.
Definition SDL3pp_gamepad.h:344
bool HasButton(GamepadButton button)
Query whether a gamepad has a given button.
Definition SDL3pp_gamepad.h:2401
void Rumble(Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
Start a rumble effect on a gamepad.
Definition SDL3pp_gamepad.h:2720
PropertiesRef GetGamepadProperties(GamepadRef gamepad)
Get the properties associated with an opened gamepad.
Definition SDL3pp_gamepad.h:1696
constexpr GamepadButton GAMEPAD_BUTTON_MISC4
Additional button (e.g. Nintendo GameCube right trigger click).
Definition SDL3pp_gamepad.h:269
GamepadRef GetGamepadFromPlayerIndex(int player_index)
Get the Gamepad associated with a player index.
Definition SDL3pp_gamepad.h:1666
constexpr GamepadAxis GAMEPAD_AXIS_LEFTY
GAMEPAD_AXIS_LEFTY.
Definition SDL3pp_gamepad.h:341
GamepadAxis GetGamepadAxisFromString(StringParam str)
Convert a string into GamepadAxis enum.
Definition SDL3pp_gamepad.h:2251
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_PADDLE2
Lower or secondary paddle, under your left hand (e.g.
Definition SDL3pp_gamepad.h:256
GamepadButton GetGamepadButtonFromString(StringParam str)
Convert a string into an GamepadButton enum.
Definition SDL3pp_gamepad.h:2356
GamepadRef GetGamepadFromID(JoystickID instance_id)
Get the Gamepad associated with a joystick instance ID, if it has been opened.
Definition SDL3pp_gamepad.h:1648
constexpr GamepadBindingType GAMEPAD_BINDTYPE_BUTTON
GAMEPAD_BINDTYPE_BUTTON.
Definition SDL3pp_gamepad.h:374
SDL_GamepadType GamepadType
Standard gamepad types.
Definition SDL3pp_gamepad.h:96
bool GetButton(GamepadButton button)
Get the current state of a button on a gamepad.
Definition SDL3pp_gamepad.h:2425
float GetGamepadSensorDataRate(GamepadRef gamepad, SensorType type)
Get the data rate (number of events per second) of a gamepad sensor.
Definition SDL3pp_gamepad.h:2649
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_UP
GAMEPAD_BUTTON_DPAD_UP.
Definition SDL3pp_gamepad.h:209
int GetNumTouchpadFingers(int touchpad)
Get the number of supported simultaneous fingers on a touchpad on a game gamepad.
Definition SDL3pp_gamepad.h:2515
float GetSensorDataRate(SensorType type)
Get the data rate (number of events per second) of a gamepad sensor.
Definition SDL3pp_gamepad.h:2654
void SetGamepadLED(GamepadRef gamepad, Uint8 red, Uint8 green, Uint8 blue)
Update a gamepad's LED color.
Definition SDL3pp_gamepad.h:2790
Uint16 GetGamepadProduct(GamepadRef gamepad)
Get the USB product ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1917
constexpr GamepadType GAMEPAD_TYPE_GAMECUBE
GAMEPAD_TYPE_GAMECUBE.
Definition SDL3pp_gamepad.h:133
void Close()
Close a gamepad previously opened with OpenGamepad().
Definition SDL3pp_gamepad.h:2838
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_B
GAMEPAD_BUTTON_LABEL_B.
Definition SDL3pp_gamepad.h:299
bool GamepadEventsEnabled()
Query the state of gamepad event processing.
Definition SDL3pp_gamepad.h:2150
bool SensorEnabled(SensorType type)
Query whether sensor data reporting is enabled for a gamepad.
Definition SDL3pp_gamepad.h:2633
SDL_Gamepad * GamepadRaw
Alias to raw representation for Gamepad.
Definition SDL3pp_gamepad.h:78
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_SHOULDER
GAMEPAD_BUTTON_LEFT_SHOULDER.
Definition SDL3pp_gamepad.h:203
constexpr GamepadType GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR
GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR.
Definition SDL3pp_gamepad.h:128
GamepadType GetRealGamepadTypeForID(JoystickID instance_id)
Get the type of a gamepad, ignoring any mapping override.
Definition SDL3pp_gamepad.h:1586
void GetGamepadSensorData(GamepadRef gamepad, SensorType type, float *data, int num_values)
Get the current state of a gamepad sensor.
Definition SDL3pp_gamepad.h:2675
Uint16 GetProductVersion()
Get the product version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1946
Uint16 GetGamepadVendorForID(JoystickID instance_id)
Get the USB vendor ID of a gamepad, if available.
Definition SDL3pp_gamepad.h:1500
Uint16 GetGamepadFirmwareVersion(GamepadRef gamepad)
Get the firmware version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1963
Uint16 GetGamepadProductForID(JoystickID instance_id)
Get the USB product ID of a gamepad, if available.
Definition SDL3pp_gamepad.h:1522
bool HasAxis(GamepadAxis axis)
Query whether a gamepad has a given axis.
Definition SDL3pp_gamepad.h:2297
SDL_GamepadButtonLabel GamepadButtonLabel
The set of gamepad button labels.
Definition SDL3pp_gamepad.h:291
ResourceRefT< GamepadBase > GamepadRef
Reference for Gamepad.
Definition SDL3pp_gamepad.h:85
void SetGamepadSensorEnabled(GamepadRef gamepad, SensorType type, bool enabled)
Set whether data reporting for a gamepad sensor is enabled.
Definition SDL3pp_gamepad.h:2603
const char * GetGamepadAppleSFSymbolsNameForAxis(GamepadRef gamepad, GamepadAxis axis)
Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2878
bool GamepadSensorEnabled(GamepadRef gamepad, SensorType type)
Query whether sensor data reporting is enabled for a gamepad.
Definition SDL3pp_gamepad.h:2628
const char * GetGamepadNameForID(JoystickID instance_id)
Get the implementation dependent name of a gamepad.
Definition SDL3pp_gamepad.h:1416
Sint16 GetGamepadAxis(GamepadRef gamepad, GamepadAxis axis)
Get the current state of an axis control on a gamepad.
Definition SDL3pp_gamepad.h:2328
OwnArray< char * > GetGamepadMappings()
Get the current gamepad mappings.
Definition SDL3pp_gamepad.h:1272
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_LEFT
GAMEPAD_BUTTON_DPAD_LEFT.
Definition SDL3pp_gamepad.h:215
bool GetGamepadButton(GamepadRef gamepad, GamepadButton button)
Get the current state of a button on a gamepad.
Definition SDL3pp_gamepad.h:2420
GUID GetGamepadGUIDForID(JoystickID instance_id)
Get the implementation-dependent GUID of a gamepad.
Definition SDL3pp_gamepad.h:1478
const char * GetAppleSFSymbolsNameForButton(GamepadButton button)
Return the sfSymbolsName for a given button on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2859
constexpr GamepadAxis GAMEPAD_AXIS_RIGHT_TRIGGER
GAMEPAD_AXIS_RIGHT_TRIGGER.
Definition SDL3pp_gamepad.h:353
constexpr GamepadBindingType GAMEPAD_BINDTYPE_HAT
GAMEPAD_BINDTYPE_HAT.
Definition SDL3pp_gamepad.h:380
bool GamepadConnected(GamepadRef gamepad)
Check if a gamepad has been opened and is currently connected.
Definition SDL3pp_gamepad.h:2079
constexpr GamepadType GAMEPAD_TYPE_COUNT
GAMEPAD_TYPE_COUNT.
Definition SDL3pp_gamepad.h:145
constexpr GamepadType GAMEPAD_TYPE_XBOXONE
GAMEPAD_TYPE_XBOXONE.
Definition SDL3pp_gamepad.h:107
constexpr GamepadAxis GAMEPAD_AXIS_LEFTX
GAMEPAD_AXIS_LEFTX.
Definition SDL3pp_gamepad.h:338
void SetGamepadPlayerIndex(GamepadRef gamepad, int player_index)
Set the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1872
StringResult GetGamepadMapping(GamepadRef gamepad)
Get the current mapping of a gamepad.
Definition SDL3pp_gamepad.h:1316
constexpr GamepadButton GAMEPAD_BUTTON_EAST
Right face button (e.g. Xbox B button).
Definition SDL3pp_gamepad.h:179
JoystickID GetID()
Get the instance ID of an opened gamepad.
Definition SDL3pp_gamepad.h:1751
PropertiesRef GetProperties()
Get the properties associated with an opened gamepad.
Definition SDL3pp_gamepad.h:1701
constexpr GamepadType GAMEPAD_TYPE_STANDARD
GAMEPAD_TYPE_STANDARD.
Definition SDL3pp_gamepad.h:101
constexpr GamepadType GAMEPAD_TYPE_PS3
GAMEPAD_TYPE_PS3.
Definition SDL3pp_gamepad.h:110
constexpr GamepadType GAMEPAD_TYPE_PS4
GAMEPAD_TYPE_PS4.
Definition SDL3pp_gamepad.h:113
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_PADDLE2
Lower or secondary paddle, under your right hand (e.g.
Definition SDL3pp_gamepad.h:248
GamepadType GetRealType()
Get the type of an opened gamepad, ignoring any mapping override.
Definition SDL3pp_gamepad.h:1829
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_CROSS
GAMEPAD_BUTTON_LABEL_CROSS.
Definition SDL3pp_gamepad.h:308
const char * GetSerial()
Get the serial number of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1990
void SendGamepadEffect(GamepadRef gamepad, const void *data, int size)
Send a gamepad specific effect packet.
Definition SDL3pp_gamepad.h:2815
const char * GetGamepadSerial(GamepadRef gamepad)
Get the serial number of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1985
bool Connected()
Check if a gamepad has been opened and is currently connected.
Definition SDL3pp_gamepad.h:2084
int AddGamepadMappingsFromIO(IOStreamRef src, bool closeio)
Load a set of gamepad mappings from an IOStream.
Definition SDL3pp_gamepad.h:1207
constexpr GamepadButton GAMEPAD_BUTTON_SOUTH
Bottom face button (e.g. Xbox A button).
Definition SDL3pp_gamepad.h:176
constexpr GamepadAxis GAMEPAD_AXIS_LEFT_TRIGGER
GAMEPAD_AXIS_LEFT_TRIGGER.
Definition SDL3pp_gamepad.h:350
Uint16 GetGamepadProductVersionForID(JoystickID instance_id)
Get the product version of a gamepad, if available.
Definition SDL3pp_gamepad.h:1544
SDL_GamepadAxis GamepadAxis
The list of axes available on a gamepad.
Definition SDL3pp_gamepad.h:333
int GetGamepadPlayerIndexForID(JoystickID instance_id)
Get the player index of a gamepad.
Definition SDL3pp_gamepad.h:1457
const char * GetGamepadPathForID(JoystickID instance_id)
Get the implementation dependent path of a gamepad.
Definition SDL3pp_gamepad.h:1437
void RumbleGamepad(GamepadRef gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
Start a rumble effect on a gamepad.
Definition SDL3pp_gamepad.h:2711
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_UNKNOWN
GAMEPAD_BUTTON_LABEL_UNKNOWN.
Definition SDL3pp_gamepad.h:293
const char * GetGamepadStringForAxis(GamepadAxis axis)
Convert from an GamepadAxis enum to a string.
Definition SDL3pp_gamepad.h:2270
JoystickID GetGamepadID(GamepadRef gamepad)
Get the instance ID of an opened gamepad.
Definition SDL3pp_gamepad.h:1746
const char * GetName()
Get the implementation-dependent name for an opened gamepad.
Definition SDL3pp_gamepad.h:1771
constexpr GamepadButton GAMEPAD_BUTTON_BACK
GAMEPAD_BUTTON_BACK.
Definition SDL3pp_gamepad.h:188
JoystickConnectionState GetGamepadConnectionState(GamepadRef gamepad)
Get the connection state of a gamepad.
Definition SDL3pp_gamepad.h:2029
void GetGamepadTouchpadFinger(GamepadRef gamepad, int touchpad, int finger, bool *down, float *x, float *y, float *pressure)
Get the current state of a finger on a touchpad on a gamepad.
Definition SDL3pp_gamepad.h:2541
StringResult GetGamepadMappingForGUID(GUID guid)
Get the gamepad mapping string for a given GUID.
Definition SDL3pp_gamepad.h:1293
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_RIGHT
GAMEPAD_BUTTON_DPAD_RIGHT.
Definition SDL3pp_gamepad.h:218
int GetGamepadPlayerIndex(GamepadRef gamepad)
Get the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1848
void SetPlayerIndex(int player_index)
Set the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1877
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_X
GAMEPAD_BUTTON_LABEL_X.
Definition SDL3pp_gamepad.h:302
GamepadButtonLabel GetGamepadButtonLabelForType(GamepadType type, GamepadButton button)
Get the label of a button on a gamepad.
Definition SDL3pp_gamepad.h:2443
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_PADDLE1
Upper or primary paddle, under your right hand (e.g.
Definition SDL3pp_gamepad.h:233
GamepadButtonLabel GetGamepadButtonLabel(GamepadRef gamepad, GamepadButton button)
Get the label of a button on a gamepad.
Definition SDL3pp_gamepad.h:2462
int GetNumGamepadTouchpads(GamepadRef gamepad)
Get the number of touchpads on a gamepad.
Definition SDL3pp_gamepad.h:2485
const char * GetGamepadAppleSFSymbolsNameForButton(GamepadRef gamepad, GamepadButton button)
Return the sfSymbolsName for a given button on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2853
int AddGamepadMapping(StringParam mapping)
Add support for gamepads that SDL is unaware of or change the binding of an existing gamepad.
Definition SDL3pp_gamepad.h:1164
constexpr GamepadButton GAMEPAD_BUTTON_INVALID
GAMEPAD_BUTTON_INVALID.
Definition SDL3pp_gamepad.h:173
SDL_GamepadBindingType GamepadBindingType
Types of gamepad control bindings.
Definition SDL3pp_gamepad.h:369
constexpr GamepadAxis GAMEPAD_AXIS_RIGHTY
GAMEPAD_AXIS_RIGHTY.
Definition SDL3pp_gamepad.h:347
GamepadType GetRealGamepadType(GamepadRef gamepad)
Get the type of an opened gamepad, ignoring any mapping override.
Definition SDL3pp_gamepad.h:1824
OwnArray< GamepadBinding * > GetBindings()
Get the SDL joystick layer bindings for a gamepad.
Definition SDL3pp_gamepad.h:2170
const char * GetGamepadPath(GamepadRef gamepad)
Get the implementation-dependent path for an opened gamepad.
Definition SDL3pp_gamepad.h:1786
GamepadType GetGamepadTypeForID(JoystickID instance_id)
Get the type of a gamepad.
Definition SDL3pp_gamepad.h:1565
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_CIRCLE
GAMEPAD_BUTTON_LABEL_CIRCLE.
Definition SDL3pp_gamepad.h:311
Uint64 GetSteamHandle()
Get the Steam Input handle of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:2013
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_TRIANGLE
GAMEPAD_BUTTON_LABEL_TRIANGLE.
Definition SDL3pp_gamepad.h:317
constexpr GamepadButton GAMEPAD_BUTTON_MISC3
Additional button (e.g. Nintendo GameCube left trigger click).
Definition SDL3pp_gamepad.h:266
char * GetGamepadMappingForID(JoystickID instance_id)
Get the mapping of a gamepad.
Definition SDL3pp_gamepad.h:1607
JoystickRef GetJoystick()
Get the underlying joystick from a gamepad.
Definition SDL3pp_gamepad.h:2111
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_PADDLE1
Upper or primary paddle, under your left hand (e.g.
Definition SDL3pp_gamepad.h:240
bool GamepadHasAxis(GamepadRef gamepad, GamepadAxis axis)
Query whether a gamepad has a given axis.
Definition SDL3pp_gamepad.h:2292
int GetPlayerIndex()
Get the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1853
Uint16 GetFirmwareVersion()
Get the firmware version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1968
bool HasGamepad()
Return whether a gamepad is currently connected.
Definition SDL3pp_gamepad.h:1359
Uint16 GetGamepadProductVersion(GamepadRef gamepad)
Get the product version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1941
void ReloadGamepadMappings()
Reinitialize the SDL mapping database to its initial state.
Definition SDL3pp_gamepad.h:1260
Uint16 GetGamepadVendor(GamepadRef gamepad)
Get the USB vendor ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1896
constexpr GamepadButton GAMEPAD_BUTTON_START
GAMEPAD_BUTTON_START.
Definition SDL3pp_gamepad.h:194
void GetTouchpadFinger(int touchpad, int finger, bool *down, float *x, float *y, float *pressure)
Get the current state of a finger on a touchpad on a gamepad.
Definition SDL3pp_gamepad.h:2553
const char * GetGamepadStringForButton(GamepadButton button)
Convert from an GamepadButton enum to a string.
Definition SDL3pp_gamepad.h:2375
JoystickRef GetGamepadJoystick(GamepadRef gamepad)
Get the underlying joystick from a gamepad.
Definition SDL3pp_gamepad.h:2106
constexpr GamepadButton GAMEPAD_BUTTON_MISC1
Additional button (e.g.
Definition SDL3pp_gamepad.h:226
constexpr GamepadAxis GAMEPAD_AXIS_COUNT
GAMEPAD_AXIS_COUNT.
Definition SDL3pp_gamepad.h:356
constexpr GamepadAxis GAMEPAD_AXIS_INVALID
GAMEPAD_AXIS_INVALID.
Definition SDL3pp_gamepad.h:335
GamepadButtonLabel GetButtonLabel(GamepadButton button)
Get the label of a button on a gamepad.
Definition SDL3pp_gamepad.h:2468
GamepadType GetGamepadTypeFromString(StringParam str)
Convert a string into GamepadType enum.
Definition SDL3pp_gamepad.h:2206
Sint16 GetAxis(GamepadAxis axis)
Get the current state of an axis control on a gamepad.
Definition SDL3pp_gamepad.h:2333
void SendEffect(const void *data, int size)
Send a gamepad specific effect packet.
Definition SDL3pp_gamepad.h:2820
constexpr GamepadButton GAMEPAD_BUTTON_WEST
Left face button (e.g. Xbox X button).
Definition SDL3pp_gamepad.h:182
OwnArray< GamepadBinding * > GetGamepadBindings(GamepadRef gamepad)
Get the SDL joystick layer bindings for a gamepad.
Definition SDL3pp_gamepad.h:2163
PowerState GetGamepadPowerInfo(GamepadRef gamepad, int *percent)
Get the battery state of a gamepad.
Definition SDL3pp_gamepad.h:2058
bool IsGamepad(JoystickID instance_id)
Check if the given joystick is supported by the gamepad interface.
Definition SDL3pp_gamepad.h:1395
Uint16 GetVendor()
Get the USB vendor ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1901
constexpr GamepadType GAMEPAD_TYPE_XBOX360
GAMEPAD_TYPE_XBOX360.
Definition SDL3pp_gamepad.h:104
constexpr GamepadType GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT
GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT.
Definition SDL3pp_gamepad.h:125
void RumbleGamepadTriggers(GamepadRef gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms)
Start a rumble effect in the gamepad's triggers.
Definition SDL3pp_gamepad.h:2755
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_STICK
GAMEPAD_BUTTON_LEFT_STICK.
Definition SDL3pp_gamepad.h:197
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_STICK
GAMEPAD_BUTTON_RIGHT_STICK.
Definition SDL3pp_gamepad.h:200
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_DOWN
GAMEPAD_BUTTON_DPAD_DOWN.
Definition SDL3pp_gamepad.h:212
constexpr GamepadButton GAMEPAD_BUTTON_MISC5
Additional button.
Definition SDL3pp_gamepad.h:271
void GetSensorData(SensorType type, float *data, int num_values)
Get the current state of a gamepad sensor.
Definition SDL3pp_gamepad.h:2683
SDL_GamepadButton GamepadButton
The list of buttons available on a gamepad.
Definition SDL3pp_gamepad.h:171
void SetGamepadMapping(JoystickID instance_id, StringParam mapping)
Set the current mapping of a joystick or gamepad.
Definition SDL3pp_gamepad.h:1343
StringResult GetMapping()
Get the current mapping of a gamepad.
Definition SDL3pp_gamepad.h:1321
void SetGamepadEventsEnabled(bool enabled)
Set the state of gamepad event processing.
Definition SDL3pp_gamepad.h:2131
constexpr GamepadType GAMEPAD_TYPE_PS5
GAMEPAD_TYPE_PS5.
Definition SDL3pp_gamepad.h:116
constexpr GamepadButton GAMEPAD_BUTTON_MISC2
Additional button.
Definition SDL3pp_gamepad.h:262
GamepadType GetGamepadType(GamepadRef gamepad)
Get the type of an opened gamepad.
Definition SDL3pp_gamepad.h:1805
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_Y
GAMEPAD_BUTTON_LABEL_Y.
Definition SDL3pp_gamepad.h:305
Gamepad OpenGamepad(JoystickID instance_id)
Open a gamepad for use.
Definition SDL3pp_gamepad.h:1626
void SetLED(Uint8 red, Uint8 green, Uint8 blue)
Update a gamepad's LED color.
Definition SDL3pp_gamepad.h:2798
void UpdateGamepads()
Manually pump gamepad updates if not using the loop.
Definition SDL3pp_gamepad.h:2186
SDL_GamepadBinding GamepadBinding
A mapping between one joystick input to a gamepad control.
Definition SDL3pp_gamepad.h:398
OwnArray< JoystickID > GetGamepads()
Get a list of currently connected gamepads.
Definition SDL3pp_gamepad.h:1374
constexpr GamepadButton GAMEPAD_BUTTON_TOUCHPAD
PS4/PS5 touchpad button.
Definition SDL3pp_gamepad.h:259
const char * GetPath()
Get the implementation-dependent path for an opened gamepad.
Definition SDL3pp_gamepad.h:1791
const char * GetGamepadStringForType(GamepadType type)
Convert from an GamepadType enum to a string.
Definition SDL3pp_gamepad.h:2225
constexpr GamepadButton GAMEPAD_BUTTON_GUIDE
GAMEPAD_BUTTON_GUIDE.
Definition SDL3pp_gamepad.h:191
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_A
GAMEPAD_BUTTON_LABEL_A.
Definition SDL3pp_gamepad.h:296
constexpr GamepadButton GAMEPAD_BUTTON_COUNT
GAMEPAD_BUTTON_COUNT.
Definition SDL3pp_gamepad.h:277
PowerState GetPowerInfo(int *percent)
Get the battery state of a gamepad.
Definition SDL3pp_gamepad.h:2063
constexpr GamepadBindingType GAMEPAD_BINDTYPE_NONE
GAMEPAD_BINDTYPE_NONE.
Definition SDL3pp_gamepad.h:371
void CloseGamepad(GamepadRaw gamepad)
Close a gamepad previously opened with OpenGamepad().
Definition SDL3pp_gamepad.h:2836
constexpr GamepadType GAMEPAD_TYPE_UNKNOWN
GAMEPAD_TYPE_UNKNOWN.
Definition SDL3pp_gamepad.h:98
constexpr GamepadButton GAMEPAD_BUTTON_NORTH
Top face button (e.g. Xbox Y button).
Definition SDL3pp_gamepad.h:185
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_SHOULDER
GAMEPAD_BUTTON_RIGHT_SHOULDER.
Definition SDL3pp_gamepad.h:206
ResourceRefT< IOStreamBase > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:37
SDL_JoystickConnectionState JoystickConnectionState
Possible connection states for a joystick device.
Definition SDL3pp_joystick.h:366
ResourceRefT< JoystickBase > JoystickRef
Reference for Joystick.
Definition SDL3pp_joystick.h:71
SDL_PowerState PowerState
The basic state for the system's power supply.
Definition SDL3pp_power.h:38
ResourceRefT< PropertiesBase > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:55
SDL_SensorType SensorType
The different sensors defined by SDL.
Definition SDL3pp_sensor.h:105
::Uint16 Uint16
An unsigned 16-bit integer type.
Definition SDL3pp_stdinc.h:270
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:296
::Sint16 Sint16
A signed 16-bit integer type.
Definition SDL3pp_stdinc.h:257
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition SDL3pp_stdinc.h:244
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition SDL3pp_stdinc.h:326
Gamepad capability properties.
Definition SDL3pp_gamepad.h:1716
constexpr auto RUMBLE_BOOLEAN
Rumble enabled.
Definition SDL3pp_gamepad.h:1727
constexpr auto MONO_LED_BOOLEAN
Mono led enabled.
Definition SDL3pp_gamepad.h:1718
constexpr auto PLAYER_LED_BOOLEAN
Player led enabled.
Definition SDL3pp_gamepad.h:1724
constexpr auto RGB_LED_BOOLEAN
Rgb led enabled.
Definition SDL3pp_gamepad.h:1721
constexpr auto TRIGGER_RUMBLE_BOOLEAN
Trigger rumble enabled.
Definition SDL3pp_gamepad.h:1730
Main include header for the SDL3pp library.
An GUID is a 128-bit identifier for an input device that identifies that device across runs of SDL pr...
Definition SDL3pp_guid.h:44
Base class to Gamepad.
Definition SDL3pp_gamepad.h:406
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
The structure used to identify an SDL gamepad.
Definition SDL3pp_gamepad.h:1074
constexpr Gamepad(Gamepad &&other) noexcept
Move constructor.
Definition SDL3pp_gamepad.h:1090
constexpr Gamepad(GamepadRaw resource) noexcept
Constructs from raw Gamepad.
Definition SDL3pp_gamepad.h:1084
~Gamepad()
Destructor.
Definition SDL3pp_gamepad.h:1112
constexpr Gamepad & operator=(Gamepad &&other) noexcept
Assignment operator.
Definition SDL3pp_gamepad.h:1115
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:93
A simple std::string-like interface for SDL allocated strings.
Definition SDL3pp_strings.h:156
StringResult(const StringResult &other)
Copy ctor.
Definition SDL3pp_strings.h:161