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
725
742 bool HasAxis(GamepadAxis axis);
743
770
786 bool HasButton(GamepadButton button);
787
801 bool GetButton(GamepadButton button);
802
816
828 int GetNumTouchpads();
829
844 int GetNumTouchpadFingers(int touchpad);
845
866 void GetTouchpadFinger(int touchpad,
867 int finger,
868 bool* down,
869 float* x,
870 float* y,
871 float* pressure);
872
887 bool HasSensor(SensorType type);
888
903 void SetSensorEnabled(SensorType type, bool enabled);
904
917 bool SensorEnabled(SensorType type);
918
929 float GetSensorDataRate(SensorType type);
930
946 void GetSensorData(SensorType type, float* data, int num_values);
947
968 void Rumble(Uint16 low_frequency_rumble,
969 Uint16 high_frequency_rumble,
970 Uint32 duration_ms);
971
998 void RumbleTriggers(Uint16 left_rumble,
999 Uint16 right_rumble,
1000 Uint32 duration_ms);
1001
1020 void SetLED(Uint8 red, Uint8 green, Uint8 blue);
1021
1033 void SendEffect(const void* data, int size);
1034
1049
1062 const char* GetAppleSFSymbolsNameForAxis(GamepadAxis axis);
1063};
1064
1073{
1074 using GamepadBase::GamepadBase;
1075
1083 constexpr explicit Gamepad(GamepadRaw resource) noexcept
1084 : GamepadBase(resource)
1085 {
1086 }
1087
1089 constexpr Gamepad(Gamepad&& other) noexcept
1090 : Gamepad(other.release())
1091 {
1092 }
1093
1108 Gamepad(JoystickID instance_id);
1109
1111 ~Gamepad() { SDL_CloseGamepad(get()); }
1112
1114 constexpr Gamepad& operator=(Gamepad&& other) noexcept
1115 {
1116 swap(*this, other);
1117 return *this;
1118 }
1119};
1120
1164{
1165 return SDL_AddGamepadMapping(mapping);
1166}
1167
1205{
1206 return SDL_AddGamepadMappingsFromIO(src.stream, src.closeio);
1207}
1208
1242{
1243 return SDL_AddGamepadMappingsFromFile(file);
1244}
1245
1257inline void ReloadGamepadMappings() { CheckError(SDL_ReloadGamepadMappings()); }
1258
1270{
1271 int count;
1272 auto data = CheckError(SDL_GetGamepadMappings(&count));
1273 return OwnArray<char*>(data);
1274}
1275
1291{
1292 return StringResult(SDL_GetGamepadMappingForGUID(guid));
1293}
1294
1314{
1315 return StringResult(SDL_GetGamepadMapping(gamepad));
1316}
1317
1322
1340inline void SetGamepadMapping(JoystickID instance_id, StringParam mapping)
1341{
1342 CheckError(SDL_SetGamepadMapping(instance_id, mapping));
1343}
1344
1356inline bool HasGamepad() { return SDL_HasGamepad(); }
1357
1372{
1373 int count;
1374 auto r = reinterpret_cast<JoystickID*>(SDL_GetGamepads(&count));
1375 return OwnArray<JoystickID>(r, count);
1376}
1377
1392inline bool IsGamepad(JoystickID instance_id)
1393{
1394 return SDL_IsGamepad(instance_id);
1395}
1396
1413inline const char* GetGamepadNameForID(JoystickID instance_id)
1414{
1415 return SDL_GetGamepadNameForID(instance_id);
1416}
1417
1434inline const char* GetGamepadPathForID(JoystickID instance_id)
1435{
1436 return SDL_GetGamepadPathForID(instance_id);
1437}
1438
1455{
1456 return SDL_GetGamepadPlayerIndexForID(instance_id);
1457}
1458
1476{
1477 return SDL_GetGamepadGUIDForID(instance_id);
1478}
1479
1498{
1499 return SDL_GetGamepadVendorForID(instance_id);
1500}
1501
1520{
1521 return SDL_GetGamepadProductForID(instance_id);
1522}
1523
1542{
1543 return SDL_GetGamepadProductVersionForID(instance_id);
1544}
1545
1563{
1564 return SDL_GetGamepadTypeForID(instance_id);
1565}
1566
1584{
1585 return SDL_GetRealGamepadTypeForID(instance_id);
1586}
1587
1604inline char* GetGamepadMappingForID(JoystickID instance_id)
1605{
1606 return SDL_GetGamepadMappingForID(instance_id);
1607}
1608
1623inline Gamepad OpenGamepad(JoystickID instance_id)
1624{
1625 return Gamepad(instance_id);
1626}
1627
1628inline Gamepad::Gamepad(JoystickID instance_id)
1629 : Gamepad(SDL_OpenGamepad(instance_id))
1630{
1631}
1632
1646{
1647 return {CheckError(SDL_GetGamepadFromID(instance_id))};
1648}
1649
1664{
1665 return {SDL_GetGamepadFromPlayerIndex(player_index)};
1666}
1667
1694{
1695 return {CheckError(SDL_GetGamepadProperties(gamepad))};
1696}
1697
1702
1714
1715constexpr auto MONO_LED_BOOLEAN =
1716 SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN;
1717
1718constexpr auto RGB_LED_BOOLEAN =
1719 SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN;
1720
1721constexpr auto PLAYER_LED_BOOLEAN =
1722 SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN;
1723
1724constexpr auto RUMBLE_BOOLEAN =
1725 SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN;
1726
1728 SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN;
1729
1730} // namespace prop::GamepadCap
1731
1744{
1745 return CheckError(SDL_GetGamepadID(gamepad));
1746}
1747
1749
1763inline const char* GetGamepadName(GamepadRef gamepad)
1764{
1765 return SDL_GetGamepadName(gamepad);
1766}
1767
1768inline const char* GamepadBase::GetName() { return SDL::GetGamepadName(get()); }
1769
1783inline const char* GetGamepadPath(GamepadRef gamepad)
1784{
1785 return SDL_GetGamepadPath(gamepad);
1786}
1787
1788inline const char* GamepadBase::GetPath() { return SDL::GetGamepadPath(get()); }
1789
1803{
1804 return SDL_GetGamepadType(gamepad);
1805}
1806
1808
1822{
1823 return SDL_GetRealGamepadType(gamepad);
1824}
1825
1830
1846{
1847 return SDL_GetGamepadPlayerIndex(gamepad);
1848}
1849
1851{
1853}
1854
1869inline void SetGamepadPlayerIndex(GamepadRef gamepad, int player_index)
1870{
1871 CheckError(SDL_SetGamepadPlayerIndex(gamepad, player_index));
1872}
1873
1874inline void GamepadBase::SetPlayerIndex(int player_index)
1875{
1876 SDL::SetGamepadPlayerIndex(get(), player_index);
1877}
1878
1894{
1895 return SDL_GetGamepadVendor(gamepad);
1896}
1897
1899
1915{
1916 return SDL_GetGamepadProduct(gamepad);
1917}
1918
1920{
1921 return SDL::GetGamepadProduct(get());
1922}
1923
1939{
1940 return SDL_GetGamepadProductVersion(gamepad);
1941}
1942
1947
1961{
1962 return SDL_GetGamepadFirmwareVersion(gamepad);
1963}
1964
1969
1982inline const char* GetGamepadSerial(GamepadRef gamepad)
1983{
1984 return SDL_GetGamepadSerial(gamepad);
1985}
1986
1987inline const char* GamepadBase::GetSerial()
1988{
1989 return SDL::GetGamepadSerial(get());
1990}
1991
2006{
2007 return SDL_GetGamepadSteamHandle(gamepad);
2008}
2009
2014
2027{
2028 return CheckError(SDL_GetGamepadConnectionState(gamepad));
2029}
2030
2035
2055inline PowerState GetGamepadPowerInfo(GamepadRef gamepad, int* percent)
2056{
2057 return SDL_GetGamepadPowerInfo(gamepad, percent);
2058}
2059
2061{
2062 return SDL::GetGamepadPowerInfo(get(), percent);
2063}
2064
2076inline bool GamepadConnected(GamepadRef gamepad)
2077{
2078 return SDL_GamepadConnected(gamepad);
2079}
2080
2082
2104{
2105 return CheckError(SDL_GetGamepadJoystick(gamepad));
2106}
2107
2112
2128inline void SetGamepadEventsEnabled(bool enabled)
2129{
2130 SDL_SetGamepadEventsEnabled(enabled);
2131}
2132
2147inline bool GamepadEventsEnabled() { return SDL_GamepadEventsEnabled(); }
2148
2161{
2162 int count;
2163 auto r = (SDL_GetGamepadBindings(gamepad, &count));
2164 return OwnArray<GamepadBinding*>(r, count);
2165}
2166
2171
2183inline void UpdateGamepads() { SDL_UpdateGamepads(); }
2184
2204{
2205 return SDL_GetGamepadTypeFromString(str);
2206}
2207
2222inline const char* GetGamepadStringForType(GamepadType type)
2223{
2224 return SDL_GetGamepadStringForType(type);
2225}
2226
2249{
2250 return SDL_GetGamepadAxisFromString(str);
2251}
2252
2267inline const char* GetGamepadStringForAxis(GamepadAxis axis)
2268{
2269 return SDL_GetGamepadStringForAxis(axis);
2270}
2271
2289inline bool GamepadHasAxis(GamepadRef gamepad, GamepadAxis axis)
2290{
2291 return SDL_GamepadHasAxis(gamepad, axis);
2292}
2293
2295{
2296 return SDL::GamepadHasAxis(get(), axis);
2297}
2298
2326{
2327 return SDL_GetGamepadAxis(gamepad, axis);
2328}
2329
2331{
2332 return SDL::GetGamepadAxis(get(), axis);
2333}
2334
2354{
2355 return SDL_GetGamepadButtonFromString(str);
2356}
2357
2373{
2374 return SDL_GetGamepadStringForButton(button);
2375}
2376
2393inline bool GamepadHasButton(GamepadRef gamepad, GamepadButton button)
2394{
2395 return SDL_GamepadHasButton(gamepad, button);
2396}
2397
2399{
2400 return SDL::GamepadHasButton(get(), button);
2401}
2402
2417inline bool GetGamepadButton(GamepadRef gamepad, GamepadButton button)
2418{
2419 return SDL_GetGamepadButton(gamepad, button);
2420}
2421
2423{
2424 return SDL::GetGamepadButton(get(), button);
2425}
2426
2441 GamepadButton button)
2442{
2443 return SDL_GetGamepadButtonLabelForType(type, button);
2444}
2445
2460 GamepadButton button)
2461{
2462 return SDL_GetGamepadButtonLabel(gamepad, button);
2463}
2464
2469
2483{
2484 return SDL_GetNumGamepadTouchpads(gamepad);
2485}
2486
2488{
2490}
2491
2507inline int GetNumGamepadTouchpadFingers(GamepadRef gamepad, int touchpad)
2508{
2509 return SDL_GetNumGamepadTouchpadFingers(gamepad, touchpad);
2510}
2511
2513{
2514 return SDL::GetNumGamepadTouchpadFingers(get(), touchpad);
2515}
2516
2539 int touchpad,
2540 int finger,
2541 bool* down,
2542 float* x,
2543 float* y,
2544 float* pressure)
2545{
2546 CheckError(SDL_GetGamepadTouchpadFinger(
2547 gamepad, touchpad, finger, down, x, y, pressure));
2548}
2549
2550inline void GamepadBase::GetTouchpadFinger(int touchpad,
2551 int finger,
2552 bool* down,
2553 float* x,
2554 float* y,
2555 float* pressure)
2556{
2557 SDL::GetGamepadTouchpadFinger(get(), touchpad, finger, down, x, y, pressure);
2558}
2559
2575inline bool GamepadHasSensor(GamepadRef gamepad, SensorType type)
2576{
2577 return SDL_GamepadHasSensor(gamepad, type);
2578}
2579
2581{
2582 return SDL::GamepadHasSensor(get(), type);
2583}
2584
2601 SensorType type,
2602 bool enabled)
2603{
2604 CheckError(SDL_SetGamepadSensorEnabled(gamepad, type, enabled));
2605}
2606
2607inline void GamepadBase::SetSensorEnabled(SensorType type, bool enabled)
2608{
2609 SDL::SetGamepadSensorEnabled(get(), type, enabled);
2610}
2611
2626{
2627 return SDL_GamepadSensorEnabled(gamepad, type);
2628}
2629
2631{
2632 return SDL::GamepadSensorEnabled(get(), type);
2633}
2634
2647{
2648 return SDL_GetGamepadSensorDataRate(gamepad, type);
2649}
2650
2652{
2653 return SDL::GetGamepadSensorDataRate(get(), type);
2654}
2655
2673 SensorType type,
2674 float* data,
2675 int num_values)
2676{
2677 CheckError(SDL_GetGamepadSensorData(gamepad, type, data, num_values));
2678}
2679
2681 float* data,
2682 int num_values)
2683{
2684 SDL::GetGamepadSensorData(get(), type, data, num_values);
2685}
2686
2708inline void RumbleGamepad(GamepadRef gamepad,
2709 Uint16 low_frequency_rumble,
2710 Uint16 high_frequency_rumble,
2711 Uint32 duration_ms)
2712{
2713 CheckError(SDL_RumbleGamepad(
2714 gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms));
2715}
2716
2717inline void GamepadBase::Rumble(Uint16 low_frequency_rumble,
2718 Uint16 high_frequency_rumble,
2719 Uint32 duration_ms)
2720{
2722 get(), low_frequency_rumble, high_frequency_rumble, duration_ms);
2723}
2724
2753 Uint16 left_rumble,
2754 Uint16 right_rumble,
2755 Uint32 duration_ms)
2756{
2757 CheckError(
2758 SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms));
2759}
2760
2761inline void GamepadBase::RumbleTriggers(Uint16 left_rumble,
2762 Uint16 right_rumble,
2763 Uint32 duration_ms)
2764{
2765 SDL::RumbleGamepadTriggers(get(), left_rumble, right_rumble, duration_ms);
2766}
2767
2787inline void SetGamepadLED(GamepadRef gamepad,
2788 Uint8 red,
2789 Uint8 green,
2790 Uint8 blue)
2791{
2792 CheckError(SDL_SetGamepadLED(gamepad, red, green, blue));
2793}
2794
2795inline void GamepadBase::SetLED(Uint8 red, Uint8 green, Uint8 blue)
2796{
2797 SDL::SetGamepadLED(get(), red, green, blue);
2798}
2799
2812inline void SendGamepadEffect(GamepadRef gamepad, const void* data, int size)
2813{
2814 CheckError(SDL_SendGamepadEffect(gamepad, data, size));
2815}
2816
2817inline void GamepadBase::SendEffect(const void* data, int size)
2818{
2819 SDL::SendGamepadEffect(get(), data, size);
2820}
2821
2833inline void CloseGamepad(GamepadRaw gamepad) { SDL_CloseGamepad(gamepad); }
2834
2836
2851 GamepadButton button)
2852{
2853 return SDL_GetGamepadAppleSFSymbolsNameForButton(gamepad, button);
2854}
2855
2857 GamepadButton button)
2858{
2860}
2861
2876 GamepadAxis axis)
2877{
2878 return SDL_GetGamepadAppleSFSymbolsNameForAxis(gamepad, axis);
2879}
2880
2885
2887
2888} // namespace SDL
2889
2890#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
int AddGamepadMappingsFromIO(IOStreamParam src)
Load a set of gamepad mappings from an IOStream.
Definition SDL3pp_gamepad.h:1204
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:2005
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:2881
int GetNumTouchpads()
Get the number of touchpads on a gamepad.
Definition SDL3pp_gamepad.h:2487
JoystickConnectionState GetConnectionState()
Get the connection state of a gamepad.
Definition SDL3pp_gamepad.h:2031
void SetSensorEnabled(SensorType type, bool enabled)
Set whether data reporting for a gamepad sensor is enabled.
Definition SDL3pp_gamepad.h:2607
void RumbleTriggers(Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms)
Start a rumble effect in the gamepad's triggers.
Definition SDL3pp_gamepad.h:2761
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:2507
int AddGamepadMappingsFromFile(StringParam file)
Load a set of gamepad mappings from a file.
Definition SDL3pp_gamepad.h:1241
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:1763
GamepadType GetType()
Get the type of an opened gamepad.
Definition SDL3pp_gamepad.h:1807
Uint16 GetProduct()
Get the USB product ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1919
bool GamepadHasButton(GamepadRef gamepad, GamepadButton button)
Query whether a gamepad has a given button.
Definition SDL3pp_gamepad.h:2393
bool GamepadHasSensor(GamepadRef gamepad, SensorType type)
Return whether a gamepad has a particular sensor.
Definition SDL3pp_gamepad.h:2575
bool HasSensor(SensorType type)
Return whether a gamepad has a particular sensor.
Definition SDL3pp_gamepad.h:2580
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:2398
void Rumble(Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
Start a rumble effect on a gamepad.
Definition SDL3pp_gamepad.h:2717
PropertiesRef GetGamepadProperties(GamepadRef gamepad)
Get the properties associated with an opened gamepad.
Definition SDL3pp_gamepad.h:1693
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:1663
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:2248
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:2353
GamepadRef GetGamepadFromID(JoystickID instance_id)
Get the Gamepad associated with a joystick instance ID, if it has been opened.
Definition SDL3pp_gamepad.h:1645
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:2422
float GetGamepadSensorDataRate(GamepadRef gamepad, SensorType type)
Get the data rate (number of events per second) of a gamepad sensor.
Definition SDL3pp_gamepad.h:2646
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:2512
float GetSensorDataRate(SensorType type)
Get the data rate (number of events per second) of a gamepad sensor.
Definition SDL3pp_gamepad.h:2651
void SetGamepadLED(GamepadRef gamepad, Uint8 red, Uint8 green, Uint8 blue)
Update a gamepad's LED color.
Definition SDL3pp_gamepad.h:2787
Uint16 GetGamepadProduct(GamepadRef gamepad)
Get the USB product ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1914
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:2835
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:2147
bool SensorEnabled(SensorType type)
Query whether sensor data reporting is enabled for a gamepad.
Definition SDL3pp_gamepad.h:2630
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:1583
void GetGamepadSensorData(GamepadRef gamepad, SensorType type, float *data, int num_values)
Get the current state of a gamepad sensor.
Definition SDL3pp_gamepad.h:2672
Uint16 GetProductVersion()
Get the product version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1943
Uint16 GetGamepadVendorForID(JoystickID instance_id)
Get the USB vendor ID of a gamepad, if available.
Definition SDL3pp_gamepad.h:1497
Uint16 GetGamepadFirmwareVersion(GamepadRef gamepad)
Get the firmware version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1960
Uint16 GetGamepadProductForID(JoystickID instance_id)
Get the USB product ID of a gamepad, if available.
Definition SDL3pp_gamepad.h:1519
bool HasAxis(GamepadAxis axis)
Query whether a gamepad has a given axis.
Definition SDL3pp_gamepad.h:2294
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:2600
const char * GetGamepadAppleSFSymbolsNameForAxis(GamepadRef gamepad, GamepadAxis axis)
Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2875
bool GamepadSensorEnabled(GamepadRef gamepad, SensorType type)
Query whether sensor data reporting is enabled for a gamepad.
Definition SDL3pp_gamepad.h:2625
const char * GetGamepadNameForID(JoystickID instance_id)
Get the implementation dependent name of a gamepad.
Definition SDL3pp_gamepad.h:1413
Sint16 GetGamepadAxis(GamepadRef gamepad, GamepadAxis axis)
Get the current state of an axis control on a gamepad.
Definition SDL3pp_gamepad.h:2325
OwnArray< char * > GetGamepadMappings()
Get the current gamepad mappings.
Definition SDL3pp_gamepad.h:1269
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:2417
GUID GetGamepadGUIDForID(JoystickID instance_id)
Get the implementation-dependent GUID of a gamepad.
Definition SDL3pp_gamepad.h:1475
const char * GetAppleSFSymbolsNameForButton(GamepadButton button)
Return the sfSymbolsName for a given button on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2856
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:2076
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:1869
StringResult GetGamepadMapping(GamepadRef gamepad)
Get the current mapping of a gamepad.
Definition SDL3pp_gamepad.h:1313
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:1748
PropertiesRef GetProperties()
Get the properties associated with an opened gamepad.
Definition SDL3pp_gamepad.h:1698
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:1826
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:1987
void SendGamepadEffect(GamepadRef gamepad, const void *data, int size)
Send a gamepad specific effect packet.
Definition SDL3pp_gamepad.h:2812
const char * GetGamepadSerial(GamepadRef gamepad)
Get the serial number of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1982
bool Connected()
Check if a gamepad has been opened and is currently connected.
Definition SDL3pp_gamepad.h:2081
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:1541
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:1454
const char * GetGamepadPathForID(JoystickID instance_id)
Get the implementation dependent path of a gamepad.
Definition SDL3pp_gamepad.h:1434
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:2708
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:2267
JoystickID GetGamepadID(GamepadRef gamepad)
Get the instance ID of an opened gamepad.
Definition SDL3pp_gamepad.h:1743
const char * GetName()
Get the implementation-dependent name for an opened gamepad.
Definition SDL3pp_gamepad.h:1768
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:2026
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:2538
StringResult GetGamepadMappingForGUID(GUID guid)
Get the gamepad mapping string for a given GUID.
Definition SDL3pp_gamepad.h:1290
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:1845
void SetPlayerIndex(int player_index)
Set the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1874
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:2440
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:2459
int GetNumGamepadTouchpads(GamepadRef gamepad)
Get the number of touchpads on a gamepad.
Definition SDL3pp_gamepad.h:2482
const char * GetGamepadAppleSFSymbolsNameForButton(GamepadRef gamepad, GamepadButton button)
Return the sfSymbolsName for a given button on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2850
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:1163
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:1821
OwnArray< GamepadBinding * > GetBindings()
Get the SDL joystick layer bindings for a gamepad.
Definition SDL3pp_gamepad.h:2167
const char * GetGamepadPath(GamepadRef gamepad)
Get the implementation-dependent path for an opened gamepad.
Definition SDL3pp_gamepad.h:1783
GamepadType GetGamepadTypeForID(JoystickID instance_id)
Get the type of a gamepad.
Definition SDL3pp_gamepad.h:1562
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:2010
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:1604
JoystickRef GetJoystick()
Get the underlying joystick from a gamepad.
Definition SDL3pp_gamepad.h:2108
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:2289
int GetPlayerIndex()
Get the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1850
Uint16 GetFirmwareVersion()
Get the firmware version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1965
bool HasGamepad()
Return whether a gamepad is currently connected.
Definition SDL3pp_gamepad.h:1356
Uint16 GetGamepadProductVersion(GamepadRef gamepad)
Get the product version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1938
void ReloadGamepadMappings()
Reinitialize the SDL mapping database to its initial state.
Definition SDL3pp_gamepad.h:1257
Uint16 GetGamepadVendor(GamepadRef gamepad)
Get the USB vendor ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1893
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:2550
const char * GetGamepadStringForButton(GamepadButton button)
Convert from an GamepadButton enum to a string.
Definition SDL3pp_gamepad.h:2372
JoystickRef GetGamepadJoystick(GamepadRef gamepad)
Get the underlying joystick from a gamepad.
Definition SDL3pp_gamepad.h:2103
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:2465
GamepadType GetGamepadTypeFromString(StringParam str)
Convert a string into GamepadType enum.
Definition SDL3pp_gamepad.h:2203
Sint16 GetAxis(GamepadAxis axis)
Get the current state of an axis control on a gamepad.
Definition SDL3pp_gamepad.h:2330
void SendEffect(const void *data, int size)
Send a gamepad specific effect packet.
Definition SDL3pp_gamepad.h:2817
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:2160
PowerState GetGamepadPowerInfo(GamepadRef gamepad, int *percent)
Get the battery state of a gamepad.
Definition SDL3pp_gamepad.h:2055
bool IsGamepad(JoystickID instance_id)
Check if the given joystick is supported by the gamepad interface.
Definition SDL3pp_gamepad.h:1392
Uint16 GetVendor()
Get the USB vendor ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1898
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:2752
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:2680
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:1340
StringResult GetMapping()
Get the current mapping of a gamepad.
Definition SDL3pp_gamepad.h:1318
void SetGamepadEventsEnabled(bool enabled)
Set the state of gamepad event processing.
Definition SDL3pp_gamepad.h:2128
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:1802
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:1623
void SetLED(Uint8 red, Uint8 green, Uint8 blue)
Update a gamepad's LED color.
Definition SDL3pp_gamepad.h:2795
void UpdateGamepads()
Manually pump gamepad updates if not using the loop.
Definition SDL3pp_gamepad.h:2183
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:1371
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:1788
const char * GetGamepadStringForType(GamepadType type)
Convert from an GamepadType enum to a string.
Definition SDL3pp_gamepad.h:2222
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:2060
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:2833
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
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:56
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:1713
constexpr auto RUMBLE_BOOLEAN
Rumble enabled.
Definition SDL3pp_gamepad.h:1724
constexpr auto MONO_LED_BOOLEAN
Mono led enabled.
Definition SDL3pp_gamepad.h:1715
constexpr auto PLAYER_LED_BOOLEAN
Player led enabled.
Definition SDL3pp_gamepad.h:1721
constexpr auto RGB_LED_BOOLEAN
Rgb led enabled.
Definition SDL3pp_gamepad.h:1718
constexpr auto TRIGGER_RUMBLE_BOOLEAN
Trigger rumble enabled.
Definition SDL3pp_gamepad.h:1727
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:1073
constexpr Gamepad(Gamepad &&other) noexcept
Move constructor.
Definition SDL3pp_gamepad.h:1089
constexpr Gamepad(GamepadRaw resource) noexcept
Constructs from raw Gamepad.
Definition SDL3pp_gamepad.h:1083
~Gamepad()
Destructor.
Definition SDL3pp_gamepad.h:1111
constexpr Gamepad & operator=(Gamepad &&other) noexcept
Assignment operator.
Definition SDL3pp_gamepad.h:1114
Wrapper to be used as parameter to LoadFile_IO() and SaveFile_IO() and similar.
Definition SDL3pp_iostream.h:2243
IOStreamRef stream
The IOStream to read from or write to.
Definition SDL3pp_iostream.h:2244
bool closeio
Whether to close the IOStream after the operation.
Definition SDL3pp_iostream.h:2245
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