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
139 SDL_GAMEPAD_TYPE_COUNT;
140
164using GamepadButton = SDL_GamepadButton;
165
167 SDL_GAMEPAD_BUTTON_INVALID;
168
170 SDL_GAMEPAD_BUTTON_SOUTH;
171
173 SDL_GAMEPAD_BUTTON_EAST;
174
176 SDL_GAMEPAD_BUTTON_WEST;
177
179 SDL_GAMEPAD_BUTTON_NORTH;
180
182 SDL_GAMEPAD_BUTTON_BACK;
183
185 SDL_GAMEPAD_BUTTON_GUIDE;
186
188 SDL_GAMEPAD_BUTTON_START;
189
191 SDL_GAMEPAD_BUTTON_LEFT_STICK;
192
194 SDL_GAMEPAD_BUTTON_RIGHT_STICK;
195
197 SDL_GAMEPAD_BUTTON_LEFT_SHOULDER;
198
200 SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER;
201
203 SDL_GAMEPAD_BUTTON_DPAD_UP;
204
206 SDL_GAMEPAD_BUTTON_DPAD_DOWN;
207
209 SDL_GAMEPAD_BUTTON_DPAD_LEFT;
210
212 SDL_GAMEPAD_BUTTON_DPAD_RIGHT;
213
219constexpr GamepadButton GAMEPAD_BUTTON_MISC1 = SDL_GAMEPAD_BUTTON_MISC1;
220
227 SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1;
228
234 SDL_GAMEPAD_BUTTON_LEFT_PADDLE1;
235
242 SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2;
243
250 SDL_GAMEPAD_BUTTON_LEFT_PADDLE2;
251
253 SDL_GAMEPAD_BUTTON_TOUCHPAD;
254
256 SDL_GAMEPAD_BUTTON_MISC2;
257
259constexpr GamepadButton GAMEPAD_BUTTON_MISC3 = SDL_GAMEPAD_BUTTON_MISC3;
260
262constexpr GamepadButton GAMEPAD_BUTTON_MISC4 = SDL_GAMEPAD_BUTTON_MISC4;
263
265 SDL_GAMEPAD_BUTTON_MISC5;
266
268 SDL_GAMEPAD_BUTTON_MISC6;
269
271 SDL_GAMEPAD_BUTTON_COUNT;
272
284using GamepadButtonLabel = SDL_GamepadButtonLabel;
285
287 SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN;
288
290 SDL_GAMEPAD_BUTTON_LABEL_A;
291
293 SDL_GAMEPAD_BUTTON_LABEL_B;
294
296 SDL_GAMEPAD_BUTTON_LABEL_X;
297
299 SDL_GAMEPAD_BUTTON_LABEL_Y;
300
302 SDL_GAMEPAD_BUTTON_LABEL_CROSS;
303
305 SDL_GAMEPAD_BUTTON_LABEL_CIRCLE;
306
308 SDL_GAMEPAD_BUTTON_LABEL_SQUARE;
309
311 SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE;
312
326using GamepadAxis = SDL_GamepadAxis;
327
329 SDL_GAMEPAD_AXIS_INVALID;
330
332 SDL_GAMEPAD_AXIS_LEFTX;
333
335 SDL_GAMEPAD_AXIS_LEFTY;
336
338 SDL_GAMEPAD_AXIS_RIGHTX;
339
341 SDL_GAMEPAD_AXIS_RIGHTY;
342
344 SDL_GAMEPAD_AXIS_LEFT_TRIGGER;
345
347 SDL_GAMEPAD_AXIS_RIGHT_TRIGGER;
348
350 SDL_GAMEPAD_AXIS_COUNT;
351
362using GamepadBindingType = SDL_GamepadBindingType;
363
365 SDL_GAMEPAD_BINDTYPE_NONE;
366
368 SDL_GAMEPAD_BINDTYPE_BUTTON;
369
371 SDL_GAMEPAD_BINDTYPE_AXIS;
372
374 SDL_GAMEPAD_BINDTYPE_HAT;
375
391using GamepadBinding = SDL_GamepadBinding;
392
398struct GamepadBase : ResourceBaseT<GamepadRaw>
399{
401
411 void Close();
412
431
458
470
483 const char* GetName();
484
497 const char* GetPath();
498
511
524
538 int GetPlayerIndex();
539
553 void SetPlayerIndex(int player_index);
554
569
584
599
612
625 const char* GetSerial();
626
640
652
672 PowerState GetPowerInfo(int* percent);
673
684 bool Connected();
685
706
719
736 bool HasAxis(GamepadAxis axis);
737
764
780 bool HasButton(GamepadButton button);
781
795 bool GetButton(GamepadButton button);
796
810
822 int GetNumTouchpads();
823
838 int GetNumTouchpadFingers(int touchpad);
839
860 void GetTouchpadFinger(int touchpad,
861 int finger,
862 bool* down,
863 float* x,
864 float* y,
865 float* pressure);
866
881 bool HasSensor(SensorType type);
882
897 void SetSensorEnabled(SensorType type, bool enabled);
898
911 bool SensorEnabled(SensorType type);
912
923 float GetSensorDataRate(SensorType type);
924
940 void GetSensorData(SensorType type, float* data, int num_values);
941
962 void Rumble(Uint16 low_frequency_rumble,
963 Uint16 high_frequency_rumble,
964 Uint32 duration_ms);
965
992 void RumbleTriggers(Uint16 left_rumble,
993 Uint16 right_rumble,
994 Uint32 duration_ms);
995
1014 void SetLED(Uint8 red, Uint8 green, Uint8 blue);
1015
1027 void SendEffect(const void* data, int size);
1028
1043
1056 const char* GetAppleSFSymbolsNameForAxis(GamepadAxis axis);
1057};
1058
1067{
1068 using GamepadBase::GamepadBase;
1069
1077 constexpr explicit Gamepad(GamepadRaw resource) noexcept
1078 : GamepadBase(resource)
1079 {
1080 }
1081
1083 constexpr Gamepad(Gamepad&& other) noexcept
1084 : Gamepad(other.release())
1085 {
1086 }
1087
1102 Gamepad(JoystickID instance_id);
1103
1105 ~Gamepad() { SDL_CloseGamepad(get()); }
1106
1108 constexpr Gamepad& operator=(Gamepad&& other) noexcept
1109 {
1110 swap(*this, other);
1111 return *this;
1112 }
1113};
1114
1158{
1159 return SDL_AddGamepadMapping(mapping);
1160}
1161
1200inline int AddGamepadMappingsFromIO(IOStreamRef src, bool closeio)
1201{
1202 return SDL_AddGamepadMappingsFromIO(src, closeio);
1203}
1204
1238{
1239 return SDL_AddGamepadMappingsFromFile(file);
1240}
1241
1253inline void ReloadGamepadMappings() { CheckError(SDL_ReloadGamepadMappings()); }
1254
1266{
1267 int count;
1268 auto data = CheckError(SDL_GetGamepadMappings(&count));
1269 return OwnArray<char*>(data);
1270}
1271
1287{
1288 return StringResult(SDL_GetGamepadMappingForGUID(guid));
1289}
1290
1310{
1311 return StringResult(SDL_GetGamepadMapping(gamepad));
1312}
1313
1318
1336inline void SetGamepadMapping(JoystickID instance_id, StringParam mapping)
1337{
1338 CheckError(SDL_SetGamepadMapping(instance_id, mapping));
1339}
1340
1352inline bool HasGamepad() { return SDL_HasGamepad(); }
1353
1368{
1369 int count;
1370 auto r = reinterpret_cast<JoystickID*>(SDL_GetGamepads(&count));
1371 return OwnArray<JoystickID>(r, count);
1372}
1373
1388inline bool IsGamepad(JoystickID instance_id)
1389{
1390 return SDL_IsGamepad(instance_id);
1391}
1392
1409inline const char* GetGamepadNameForID(JoystickID instance_id)
1410{
1411 return SDL_GetGamepadNameForID(instance_id);
1412}
1413
1430inline const char* GetGamepadPathForID(JoystickID instance_id)
1431{
1432 return SDL_GetGamepadPathForID(instance_id);
1433}
1434
1451{
1452 return SDL_GetGamepadPlayerIndexForID(instance_id);
1453}
1454
1472{
1473 return SDL_GetGamepadGUIDForID(instance_id);
1474}
1475
1494{
1495 return SDL_GetGamepadVendorForID(instance_id);
1496}
1497
1516{
1517 return SDL_GetGamepadProductForID(instance_id);
1518}
1519
1538{
1539 return SDL_GetGamepadProductVersionForID(instance_id);
1540}
1541
1559{
1560 return SDL_GetGamepadTypeForID(instance_id);
1561}
1562
1580{
1581 return SDL_GetRealGamepadTypeForID(instance_id);
1582}
1583
1600inline char* GetGamepadMappingForID(JoystickID instance_id)
1601{
1602 return SDL_GetGamepadMappingForID(instance_id);
1603}
1604
1619inline Gamepad OpenGamepad(JoystickID instance_id)
1620{
1621 return Gamepad(instance_id);
1622}
1623
1624inline Gamepad::Gamepad(JoystickID instance_id)
1625 : Gamepad(SDL_OpenGamepad(instance_id))
1626{
1627}
1628
1642{
1643 return {CheckError(SDL_GetGamepadFromID(instance_id))};
1644}
1645
1660{
1661 return {SDL_GetGamepadFromPlayerIndex(player_index)};
1662}
1663
1690{
1691 return {CheckError(SDL_GetGamepadProperties(gamepad))};
1692}
1693
1698
1710
1711constexpr auto MONO_LED_BOOLEAN =
1712 SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN;
1713
1714constexpr auto RGB_LED_BOOLEAN =
1715 SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN;
1716
1717constexpr auto PLAYER_LED_BOOLEAN =
1718 SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN;
1719
1720constexpr auto RUMBLE_BOOLEAN =
1721 SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN;
1722
1724 SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN;
1725
1726} // namespace prop::GamepadCap
1727
1740{
1741 return CheckError(SDL_GetGamepadID(gamepad));
1742}
1743
1745
1759inline const char* GetGamepadName(GamepadRef gamepad)
1760{
1761 return SDL_GetGamepadName(gamepad);
1762}
1763
1764inline const char* GamepadBase::GetName() { return SDL::GetGamepadName(get()); }
1765
1779inline const char* GetGamepadPath(GamepadRef gamepad)
1780{
1781 return SDL_GetGamepadPath(gamepad);
1782}
1783
1784inline const char* GamepadBase::GetPath() { return SDL::GetGamepadPath(get()); }
1785
1799{
1800 return SDL_GetGamepadType(gamepad);
1801}
1802
1804
1818{
1819 return SDL_GetRealGamepadType(gamepad);
1820}
1821
1826
1842{
1843 return SDL_GetGamepadPlayerIndex(gamepad);
1844}
1845
1847{
1849}
1850
1865inline void SetGamepadPlayerIndex(GamepadRef gamepad, int player_index)
1866{
1867 CheckError(SDL_SetGamepadPlayerIndex(gamepad, player_index));
1868}
1869
1870inline void GamepadBase::SetPlayerIndex(int player_index)
1871{
1872 SDL::SetGamepadPlayerIndex(get(), player_index);
1873}
1874
1890{
1891 return SDL_GetGamepadVendor(gamepad);
1892}
1893
1895
1911{
1912 return SDL_GetGamepadProduct(gamepad);
1913}
1914
1916{
1917 return SDL::GetGamepadProduct(get());
1918}
1919
1935{
1936 return SDL_GetGamepadProductVersion(gamepad);
1937}
1938
1943
1957{
1958 return SDL_GetGamepadFirmwareVersion(gamepad);
1959}
1960
1965
1978inline const char* GetGamepadSerial(GamepadRef gamepad)
1979{
1980 return SDL_GetGamepadSerial(gamepad);
1981}
1982
1983inline const char* GamepadBase::GetSerial()
1984{
1985 return SDL::GetGamepadSerial(get());
1986}
1987
2002{
2003 return SDL_GetGamepadSteamHandle(gamepad);
2004}
2005
2010
2023{
2024 return CheckError(SDL_GetGamepadConnectionState(gamepad));
2025}
2026
2031
2051inline PowerState GetGamepadPowerInfo(GamepadRef gamepad, int* percent)
2052{
2053 return SDL_GetGamepadPowerInfo(gamepad, percent);
2054}
2055
2057{
2058 return SDL::GetGamepadPowerInfo(get(), percent);
2059}
2060
2072inline bool GamepadConnected(GamepadRef gamepad)
2073{
2074 return SDL_GamepadConnected(gamepad);
2075}
2076
2078
2100{
2101 return CheckError(SDL_GetGamepadJoystick(gamepad));
2102}
2103
2108
2124inline void SetGamepadEventsEnabled(bool enabled)
2125{
2126 SDL_SetGamepadEventsEnabled(enabled);
2127}
2128
2143inline bool GamepadEventsEnabled() { return SDL_GamepadEventsEnabled(); }
2144
2157{
2158 int count;
2159 auto r = (SDL_GetGamepadBindings(gamepad, &count));
2160 return OwnArray<GamepadBinding*>(r, count);
2161}
2162
2167
2179inline void UpdateGamepads() { SDL_UpdateGamepads(); }
2180
2200{
2201 return SDL_GetGamepadTypeFromString(str);
2202}
2203
2218inline const char* GetGamepadStringForType(GamepadType type)
2219{
2220 return SDL_GetGamepadStringForType(type);
2221}
2222
2245{
2246 return SDL_GetGamepadAxisFromString(str);
2247}
2248
2263inline const char* GetGamepadStringForAxis(GamepadAxis axis)
2264{
2265 return SDL_GetGamepadStringForAxis(axis);
2266}
2267
2285inline bool GamepadHasAxis(GamepadRef gamepad, GamepadAxis axis)
2286{
2287 return SDL_GamepadHasAxis(gamepad, axis);
2288}
2289
2291{
2292 return SDL::GamepadHasAxis(get(), axis);
2293}
2294
2322{
2323 return SDL_GetGamepadAxis(gamepad, axis);
2324}
2325
2327{
2328 return SDL::GetGamepadAxis(get(), axis);
2329}
2330
2350{
2351 return SDL_GetGamepadButtonFromString(str);
2352}
2353
2369{
2370 return SDL_GetGamepadStringForButton(button);
2371}
2372
2389inline bool GamepadHasButton(GamepadRef gamepad, GamepadButton button)
2390{
2391 return SDL_GamepadHasButton(gamepad, button);
2392}
2393
2395{
2396 return SDL::GamepadHasButton(get(), button);
2397}
2398
2413inline bool GetGamepadButton(GamepadRef gamepad, GamepadButton button)
2414{
2415 return SDL_GetGamepadButton(gamepad, button);
2416}
2417
2419{
2420 return SDL::GetGamepadButton(get(), button);
2421}
2422
2437 GamepadButton button)
2438{
2439 return SDL_GetGamepadButtonLabelForType(type, button);
2440}
2441
2456 GamepadButton button)
2457{
2458 return SDL_GetGamepadButtonLabel(gamepad, button);
2459}
2460
2465
2479{
2480 return SDL_GetNumGamepadTouchpads(gamepad);
2481}
2482
2484{
2486}
2487
2503inline int GetNumGamepadTouchpadFingers(GamepadRef gamepad, int touchpad)
2504{
2505 return SDL_GetNumGamepadTouchpadFingers(gamepad, touchpad);
2506}
2507
2509{
2510 return SDL::GetNumGamepadTouchpadFingers(get(), touchpad);
2511}
2512
2535 int touchpad,
2536 int finger,
2537 bool* down,
2538 float* x,
2539 float* y,
2540 float* pressure)
2541{
2542 CheckError(SDL_GetGamepadTouchpadFinger(
2543 gamepad, touchpad, finger, down, x, y, pressure));
2544}
2545
2546inline void GamepadBase::GetTouchpadFinger(int touchpad,
2547 int finger,
2548 bool* down,
2549 float* x,
2550 float* y,
2551 float* pressure)
2552{
2553 SDL::GetGamepadTouchpadFinger(get(), touchpad, finger, down, x, y, pressure);
2554}
2555
2571inline bool GamepadHasSensor(GamepadRef gamepad, SensorType type)
2572{
2573 return SDL_GamepadHasSensor(gamepad, type);
2574}
2575
2577{
2578 return SDL::GamepadHasSensor(get(), type);
2579}
2580
2597 SensorType type,
2598 bool enabled)
2599{
2600 CheckError(SDL_SetGamepadSensorEnabled(gamepad, type, enabled));
2601}
2602
2603inline void GamepadBase::SetSensorEnabled(SensorType type, bool enabled)
2604{
2605 SDL::SetGamepadSensorEnabled(get(), type, enabled);
2606}
2607
2622{
2623 return SDL_GamepadSensorEnabled(gamepad, type);
2624}
2625
2627{
2628 return SDL::GamepadSensorEnabled(get(), type);
2629}
2630
2643{
2644 return SDL_GetGamepadSensorDataRate(gamepad, type);
2645}
2646
2648{
2649 return SDL::GetGamepadSensorDataRate(get(), type);
2650}
2651
2669 SensorType type,
2670 float* data,
2671 int num_values)
2672{
2673 CheckError(SDL_GetGamepadSensorData(gamepad, type, data, num_values));
2674}
2675
2677 float* data,
2678 int num_values)
2679{
2680 SDL::GetGamepadSensorData(get(), type, data, num_values);
2681}
2682
2704inline void RumbleGamepad(GamepadRef gamepad,
2705 Uint16 low_frequency_rumble,
2706 Uint16 high_frequency_rumble,
2707 Uint32 duration_ms)
2708{
2709 CheckError(SDL_RumbleGamepad(
2710 gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms));
2711}
2712
2713inline void GamepadBase::Rumble(Uint16 low_frequency_rumble,
2714 Uint16 high_frequency_rumble,
2715 Uint32 duration_ms)
2716{
2718 get(), low_frequency_rumble, high_frequency_rumble, duration_ms);
2719}
2720
2749 Uint16 left_rumble,
2750 Uint16 right_rumble,
2751 Uint32 duration_ms)
2752{
2753 CheckError(
2754 SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms));
2755}
2756
2757inline void GamepadBase::RumbleTriggers(Uint16 left_rumble,
2758 Uint16 right_rumble,
2759 Uint32 duration_ms)
2760{
2761 SDL::RumbleGamepadTriggers(get(), left_rumble, right_rumble, duration_ms);
2762}
2763
2783inline void SetGamepadLED(GamepadRef gamepad,
2784 Uint8 red,
2785 Uint8 green,
2786 Uint8 blue)
2787{
2788 CheckError(SDL_SetGamepadLED(gamepad, red, green, blue));
2789}
2790
2791inline void GamepadBase::SetLED(Uint8 red, Uint8 green, Uint8 blue)
2792{
2793 SDL::SetGamepadLED(get(), red, green, blue);
2794}
2795
2808inline void SendGamepadEffect(GamepadRef gamepad, const void* data, int size)
2809{
2810 CheckError(SDL_SendGamepadEffect(gamepad, data, size));
2811}
2812
2813inline void GamepadBase::SendEffect(const void* data, int size)
2814{
2815 SDL::SendGamepadEffect(get(), data, size);
2816}
2817
2829inline void CloseGamepad(GamepadRaw gamepad) { SDL_CloseGamepad(gamepad); }
2830
2832
2847 GamepadButton button)
2848{
2849 return SDL_GetGamepadAppleSFSymbolsNameForButton(gamepad, button);
2850}
2851
2853 GamepadButton button)
2854{
2856}
2857
2872 GamepadAxis axis)
2873{
2874 return SDL_GetGamepadAppleSFSymbolsNameForAxis(gamepad, axis);
2875}
2876
2881
2883
2884} // namespace SDL
2885
2886#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 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
Uint64 GetGamepadSteamHandle(GamepadRef gamepad)
Get the Steam Input handle of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:2001
constexpr GamepadButton GAMEPAD_BUTTON_MISC6
Additional button.
Definition SDL3pp_gamepad.h:267
const char * GetAppleSFSymbolsNameForAxis(GamepadAxis axis)
Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2877
int GetNumTouchpads()
Get the number of touchpads on a gamepad.
Definition SDL3pp_gamepad.h:2483
JoystickConnectionState GetConnectionState()
Get the connection state of a gamepad.
Definition SDL3pp_gamepad.h:2027
void SetSensorEnabled(SensorType type, bool enabled)
Set whether data reporting for a gamepad sensor is enabled.
Definition SDL3pp_gamepad.h:2603
void RumbleTriggers(Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms)
Start a rumble effect in the gamepad's triggers.
Definition SDL3pp_gamepad.h:2757
constexpr GamepadBindingType GAMEPAD_BINDTYPE_AXIS
GAMEPAD_BINDTYPE_AXIS.
Definition SDL3pp_gamepad.h:370
int GetNumGamepadTouchpadFingers(GamepadRef gamepad, int touchpad)
Get the number of supported simultaneous fingers on a touchpad on a game gamepad.
Definition SDL3pp_gamepad.h:2503
int AddGamepadMappingsFromFile(StringParam file)
Load a set of gamepad mappings from a file.
Definition SDL3pp_gamepad.h:1237
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:1759
GamepadType GetType()
Get the type of an opened gamepad.
Definition SDL3pp_gamepad.h:1803
Uint16 GetProduct()
Get the USB product ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1915
bool GamepadHasButton(GamepadRef gamepad, GamepadButton button)
Query whether a gamepad has a given button.
Definition SDL3pp_gamepad.h:2389
bool GamepadHasSensor(GamepadRef gamepad, SensorType type)
Return whether a gamepad has a particular sensor.
Definition SDL3pp_gamepad.h:2571
bool HasSensor(SensorType type)
Return whether a gamepad has a particular sensor.
Definition SDL3pp_gamepad.h:2576
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_SQUARE
GAMEPAD_BUTTON_LABEL_SQUARE.
Definition SDL3pp_gamepad.h:307
constexpr GamepadAxis GAMEPAD_AXIS_RIGHTX
GAMEPAD_AXIS_RIGHTX.
Definition SDL3pp_gamepad.h:337
bool HasButton(GamepadButton button)
Query whether a gamepad has a given button.
Definition SDL3pp_gamepad.h:2394
void Rumble(Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
Start a rumble effect on a gamepad.
Definition SDL3pp_gamepad.h:2713
PropertiesRef GetGamepadProperties(GamepadRef gamepad)
Get the properties associated with an opened gamepad.
Definition SDL3pp_gamepad.h:1689
constexpr GamepadButton GAMEPAD_BUTTON_MISC4
Additional button (e.g. Nintendo GameCube right trigger click).
Definition SDL3pp_gamepad.h:262
GamepadRef GetGamepadFromPlayerIndex(int player_index)
Get the Gamepad associated with a player index.
Definition SDL3pp_gamepad.h:1659
constexpr GamepadAxis GAMEPAD_AXIS_LEFTY
GAMEPAD_AXIS_LEFTY.
Definition SDL3pp_gamepad.h:334
GamepadAxis GetGamepadAxisFromString(StringParam str)
Convert a string into GamepadAxis enum.
Definition SDL3pp_gamepad.h:2244
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_PADDLE2
Lower or secondary paddle, under your left hand (e.g.
Definition SDL3pp_gamepad.h:249
GamepadButton GetGamepadButtonFromString(StringParam str)
Convert a string into an GamepadButton enum.
Definition SDL3pp_gamepad.h:2349
GamepadRef GetGamepadFromID(JoystickID instance_id)
Get the Gamepad associated with a joystick instance ID, if it has been opened.
Definition SDL3pp_gamepad.h:1641
constexpr GamepadBindingType GAMEPAD_BINDTYPE_BUTTON
GAMEPAD_BINDTYPE_BUTTON.
Definition SDL3pp_gamepad.h:367
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:2418
float GetGamepadSensorDataRate(GamepadRef gamepad, SensorType type)
Get the data rate (number of events per second) of a gamepad sensor.
Definition SDL3pp_gamepad.h:2642
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_UP
GAMEPAD_BUTTON_DPAD_UP.
Definition SDL3pp_gamepad.h:202
int GetNumTouchpadFingers(int touchpad)
Get the number of supported simultaneous fingers on a touchpad on a game gamepad.
Definition SDL3pp_gamepad.h:2508
float GetSensorDataRate(SensorType type)
Get the data rate (number of events per second) of a gamepad sensor.
Definition SDL3pp_gamepad.h:2647
void SetGamepadLED(GamepadRef gamepad, Uint8 red, Uint8 green, Uint8 blue)
Update a gamepad's LED color.
Definition SDL3pp_gamepad.h:2783
Uint16 GetGamepadProduct(GamepadRef gamepad)
Get the USB product ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1910
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:2831
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_B
GAMEPAD_BUTTON_LABEL_B.
Definition SDL3pp_gamepad.h:292
bool GamepadEventsEnabled()
Query the state of gamepad event processing.
Definition SDL3pp_gamepad.h:2143
bool SensorEnabled(SensorType type)
Query whether sensor data reporting is enabled for a gamepad.
Definition SDL3pp_gamepad.h:2626
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:196
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:1579
void GetGamepadSensorData(GamepadRef gamepad, SensorType type, float *data, int num_values)
Get the current state of a gamepad sensor.
Definition SDL3pp_gamepad.h:2668
Uint16 GetProductVersion()
Get the product version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1939
Uint16 GetGamepadVendorForID(JoystickID instance_id)
Get the USB vendor ID of a gamepad, if available.
Definition SDL3pp_gamepad.h:1493
Uint16 GetGamepadFirmwareVersion(GamepadRef gamepad)
Get the firmware version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1956
Uint16 GetGamepadProductForID(JoystickID instance_id)
Get the USB product ID of a gamepad, if available.
Definition SDL3pp_gamepad.h:1515
bool HasAxis(GamepadAxis axis)
Query whether a gamepad has a given axis.
Definition SDL3pp_gamepad.h:2290
SDL_GamepadButtonLabel GamepadButtonLabel
The set of gamepad button labels.
Definition SDL3pp_gamepad.h:284
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:2596
const char * GetGamepadAppleSFSymbolsNameForAxis(GamepadRef gamepad, GamepadAxis axis)
Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2871
bool GamepadSensorEnabled(GamepadRef gamepad, SensorType type)
Query whether sensor data reporting is enabled for a gamepad.
Definition SDL3pp_gamepad.h:2621
const char * GetGamepadNameForID(JoystickID instance_id)
Get the implementation dependent name of a gamepad.
Definition SDL3pp_gamepad.h:1409
Sint16 GetGamepadAxis(GamepadRef gamepad, GamepadAxis axis)
Get the current state of an axis control on a gamepad.
Definition SDL3pp_gamepad.h:2321
OwnArray< char * > GetGamepadMappings()
Get the current gamepad mappings.
Definition SDL3pp_gamepad.h:1265
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_LEFT
GAMEPAD_BUTTON_DPAD_LEFT.
Definition SDL3pp_gamepad.h:208
bool GetGamepadButton(GamepadRef gamepad, GamepadButton button)
Get the current state of a button on a gamepad.
Definition SDL3pp_gamepad.h:2413
GUID GetGamepadGUIDForID(JoystickID instance_id)
Get the implementation-dependent GUID of a gamepad.
Definition SDL3pp_gamepad.h:1471
const char * GetAppleSFSymbolsNameForButton(GamepadButton button)
Return the sfSymbolsName for a given button on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2852
constexpr GamepadAxis GAMEPAD_AXIS_RIGHT_TRIGGER
GAMEPAD_AXIS_RIGHT_TRIGGER.
Definition SDL3pp_gamepad.h:346
constexpr GamepadBindingType GAMEPAD_BINDTYPE_HAT
GAMEPAD_BINDTYPE_HAT.
Definition SDL3pp_gamepad.h:373
bool GamepadConnected(GamepadRef gamepad)
Check if a gamepad has been opened and is currently connected.
Definition SDL3pp_gamepad.h:2072
constexpr GamepadType GAMEPAD_TYPE_COUNT
GAMEPAD_TYPE_COUNT.
Definition SDL3pp_gamepad.h:138
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:331
void SetGamepadPlayerIndex(GamepadRef gamepad, int player_index)
Set the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1865
StringResult GetGamepadMapping(GamepadRef gamepad)
Get the current mapping of a gamepad.
Definition SDL3pp_gamepad.h:1309
constexpr GamepadButton GAMEPAD_BUTTON_EAST
Right face button (e.g. Xbox B button).
Definition SDL3pp_gamepad.h:172
JoystickID GetID()
Get the instance ID of an opened gamepad.
Definition SDL3pp_gamepad.h:1744
PropertiesRef GetProperties()
Get the properties associated with an opened gamepad.
Definition SDL3pp_gamepad.h:1694
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:241
GamepadType GetRealType()
Get the type of an opened gamepad, ignoring any mapping override.
Definition SDL3pp_gamepad.h:1822
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_CROSS
GAMEPAD_BUTTON_LABEL_CROSS.
Definition SDL3pp_gamepad.h:301
const char * GetSerial()
Get the serial number of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1983
void SendGamepadEffect(GamepadRef gamepad, const void *data, int size)
Send a gamepad specific effect packet.
Definition SDL3pp_gamepad.h:2808
const char * GetGamepadSerial(GamepadRef gamepad)
Get the serial number of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1978
bool Connected()
Check if a gamepad has been opened and is currently connected.
Definition SDL3pp_gamepad.h:2077
int AddGamepadMappingsFromIO(IOStreamRef src, bool closeio)
Load a set of gamepad mappings from an IOStream.
Definition SDL3pp_gamepad.h:1200
constexpr GamepadButton GAMEPAD_BUTTON_SOUTH
Bottom face button (e.g. Xbox A button).
Definition SDL3pp_gamepad.h:169
constexpr GamepadAxis GAMEPAD_AXIS_LEFT_TRIGGER
GAMEPAD_AXIS_LEFT_TRIGGER.
Definition SDL3pp_gamepad.h:343
Uint16 GetGamepadProductVersionForID(JoystickID instance_id)
Get the product version of a gamepad, if available.
Definition SDL3pp_gamepad.h:1537
SDL_GamepadAxis GamepadAxis
The list of axes available on a gamepad.
Definition SDL3pp_gamepad.h:326
int GetGamepadPlayerIndexForID(JoystickID instance_id)
Get the player index of a gamepad.
Definition SDL3pp_gamepad.h:1450
const char * GetGamepadPathForID(JoystickID instance_id)
Get the implementation dependent path of a gamepad.
Definition SDL3pp_gamepad.h:1430
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:2704
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_UNKNOWN
GAMEPAD_BUTTON_LABEL_UNKNOWN.
Definition SDL3pp_gamepad.h:286
const char * GetGamepadStringForAxis(GamepadAxis axis)
Convert from an GamepadAxis enum to a string.
Definition SDL3pp_gamepad.h:2263
JoystickID GetGamepadID(GamepadRef gamepad)
Get the instance ID of an opened gamepad.
Definition SDL3pp_gamepad.h:1739
const char * GetName()
Get the implementation-dependent name for an opened gamepad.
Definition SDL3pp_gamepad.h:1764
constexpr GamepadButton GAMEPAD_BUTTON_BACK
GAMEPAD_BUTTON_BACK.
Definition SDL3pp_gamepad.h:181
JoystickConnectionState GetGamepadConnectionState(GamepadRef gamepad)
Get the connection state of a gamepad.
Definition SDL3pp_gamepad.h:2022
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:2534
StringResult GetGamepadMappingForGUID(GUID guid)
Get the gamepad mapping string for a given GUID.
Definition SDL3pp_gamepad.h:1286
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_RIGHT
GAMEPAD_BUTTON_DPAD_RIGHT.
Definition SDL3pp_gamepad.h:211
int GetGamepadPlayerIndex(GamepadRef gamepad)
Get the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1841
void SetPlayerIndex(int player_index)
Set the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1870
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_X
GAMEPAD_BUTTON_LABEL_X.
Definition SDL3pp_gamepad.h:295
GamepadButtonLabel GetGamepadButtonLabelForType(GamepadType type, GamepadButton button)
Get the label of a button on a gamepad.
Definition SDL3pp_gamepad.h:2436
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_PADDLE1
Upper or primary paddle, under your right hand (e.g.
Definition SDL3pp_gamepad.h:226
GamepadButtonLabel GetGamepadButtonLabel(GamepadRef gamepad, GamepadButton button)
Get the label of a button on a gamepad.
Definition SDL3pp_gamepad.h:2455
int GetNumGamepadTouchpads(GamepadRef gamepad)
Get the number of touchpads on a gamepad.
Definition SDL3pp_gamepad.h:2478
const char * GetGamepadAppleSFSymbolsNameForButton(GamepadRef gamepad, GamepadButton button)
Return the sfSymbolsName for a given button on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2846
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:1157
constexpr GamepadButton GAMEPAD_BUTTON_INVALID
GAMEPAD_BUTTON_INVALID.
Definition SDL3pp_gamepad.h:166
SDL_GamepadBindingType GamepadBindingType
Types of gamepad control bindings.
Definition SDL3pp_gamepad.h:362
constexpr GamepadAxis GAMEPAD_AXIS_RIGHTY
GAMEPAD_AXIS_RIGHTY.
Definition SDL3pp_gamepad.h:340
GamepadType GetRealGamepadType(GamepadRef gamepad)
Get the type of an opened gamepad, ignoring any mapping override.
Definition SDL3pp_gamepad.h:1817
OwnArray< GamepadBinding * > GetBindings()
Get the SDL joystick layer bindings for a gamepad.
Definition SDL3pp_gamepad.h:2163
const char * GetGamepadPath(GamepadRef gamepad)
Get the implementation-dependent path for an opened gamepad.
Definition SDL3pp_gamepad.h:1779
GamepadType GetGamepadTypeForID(JoystickID instance_id)
Get the type of a gamepad.
Definition SDL3pp_gamepad.h:1558
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_CIRCLE
GAMEPAD_BUTTON_LABEL_CIRCLE.
Definition SDL3pp_gamepad.h:304
Uint64 GetSteamHandle()
Get the Steam Input handle of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:2006
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_TRIANGLE
GAMEPAD_BUTTON_LABEL_TRIANGLE.
Definition SDL3pp_gamepad.h:310
constexpr GamepadButton GAMEPAD_BUTTON_MISC3
Additional button (e.g. Nintendo GameCube left trigger click).
Definition SDL3pp_gamepad.h:259
char * GetGamepadMappingForID(JoystickID instance_id)
Get the mapping of a gamepad.
Definition SDL3pp_gamepad.h:1600
JoystickRef GetJoystick()
Get the underlying joystick from a gamepad.
Definition SDL3pp_gamepad.h:2104
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_PADDLE1
Upper or primary paddle, under your left hand (e.g.
Definition SDL3pp_gamepad.h:233
bool GamepadHasAxis(GamepadRef gamepad, GamepadAxis axis)
Query whether a gamepad has a given axis.
Definition SDL3pp_gamepad.h:2285
int GetPlayerIndex()
Get the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1846
Uint16 GetFirmwareVersion()
Get the firmware version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1961
bool HasGamepad()
Return whether a gamepad is currently connected.
Definition SDL3pp_gamepad.h:1352
Uint16 GetGamepadProductVersion(GamepadRef gamepad)
Get the product version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1934
void ReloadGamepadMappings()
Reinitialize the SDL mapping database to its initial state.
Definition SDL3pp_gamepad.h:1253
Uint16 GetGamepadVendor(GamepadRef gamepad)
Get the USB vendor ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1889
constexpr GamepadButton GAMEPAD_BUTTON_START
GAMEPAD_BUTTON_START.
Definition SDL3pp_gamepad.h:187
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:2546
const char * GetGamepadStringForButton(GamepadButton button)
Convert from an GamepadButton enum to a string.
Definition SDL3pp_gamepad.h:2368
JoystickRef GetGamepadJoystick(GamepadRef gamepad)
Get the underlying joystick from a gamepad.
Definition SDL3pp_gamepad.h:2099
constexpr GamepadButton GAMEPAD_BUTTON_MISC1
Additional button (e.g.
Definition SDL3pp_gamepad.h:219
constexpr GamepadAxis GAMEPAD_AXIS_COUNT
GAMEPAD_AXIS_COUNT.
Definition SDL3pp_gamepad.h:349
constexpr GamepadAxis GAMEPAD_AXIS_INVALID
GAMEPAD_AXIS_INVALID.
Definition SDL3pp_gamepad.h:328
GamepadButtonLabel GetButtonLabel(GamepadButton button)
Get the label of a button on a gamepad.
Definition SDL3pp_gamepad.h:2461
GamepadType GetGamepadTypeFromString(StringParam str)
Convert a string into GamepadType enum.
Definition SDL3pp_gamepad.h:2199
Sint16 GetAxis(GamepadAxis axis)
Get the current state of an axis control on a gamepad.
Definition SDL3pp_gamepad.h:2326
void SendEffect(const void *data, int size)
Send a gamepad specific effect packet.
Definition SDL3pp_gamepad.h:2813
constexpr GamepadButton GAMEPAD_BUTTON_WEST
Left face button (e.g. Xbox X button).
Definition SDL3pp_gamepad.h:175
OwnArray< GamepadBinding * > GetGamepadBindings(GamepadRef gamepad)
Get the SDL joystick layer bindings for a gamepad.
Definition SDL3pp_gamepad.h:2156
PowerState GetGamepadPowerInfo(GamepadRef gamepad, int *percent)
Get the battery state of a gamepad.
Definition SDL3pp_gamepad.h:2051
bool IsGamepad(JoystickID instance_id)
Check if the given joystick is supported by the gamepad interface.
Definition SDL3pp_gamepad.h:1388
Uint16 GetVendor()
Get the USB vendor ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1894
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:2748
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_STICK
GAMEPAD_BUTTON_LEFT_STICK.
Definition SDL3pp_gamepad.h:190
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_STICK
GAMEPAD_BUTTON_RIGHT_STICK.
Definition SDL3pp_gamepad.h:193
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_DOWN
GAMEPAD_BUTTON_DPAD_DOWN.
Definition SDL3pp_gamepad.h:205
constexpr GamepadButton GAMEPAD_BUTTON_MISC5
Additional button.
Definition SDL3pp_gamepad.h:264
void GetSensorData(SensorType type, float *data, int num_values)
Get the current state of a gamepad sensor.
Definition SDL3pp_gamepad.h:2676
SDL_GamepadButton GamepadButton
The list of buttons available on a gamepad.
Definition SDL3pp_gamepad.h:164
void SetGamepadMapping(JoystickID instance_id, StringParam mapping)
Set the current mapping of a joystick or gamepad.
Definition SDL3pp_gamepad.h:1336
StringResult GetMapping()
Get the current mapping of a gamepad.
Definition SDL3pp_gamepad.h:1314
void SetGamepadEventsEnabled(bool enabled)
Set the state of gamepad event processing.
Definition SDL3pp_gamepad.h:2124
constexpr GamepadType GAMEPAD_TYPE_PS5
GAMEPAD_TYPE_PS5.
Definition SDL3pp_gamepad.h:116
constexpr GamepadButton GAMEPAD_BUTTON_MISC2
Additional button.
Definition SDL3pp_gamepad.h:255
GamepadType GetGamepadType(GamepadRef gamepad)
Get the type of an opened gamepad.
Definition SDL3pp_gamepad.h:1798
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_Y
GAMEPAD_BUTTON_LABEL_Y.
Definition SDL3pp_gamepad.h:298
Gamepad OpenGamepad(JoystickID instance_id)
Open a gamepad for use.
Definition SDL3pp_gamepad.h:1619
void SetLED(Uint8 red, Uint8 green, Uint8 blue)
Update a gamepad's LED color.
Definition SDL3pp_gamepad.h:2791
void UpdateGamepads()
Manually pump gamepad updates if not using the loop.
Definition SDL3pp_gamepad.h:2179
SDL_GamepadBinding GamepadBinding
A mapping between one joystick input to a gamepad control.
Definition SDL3pp_gamepad.h:391
OwnArray< JoystickID > GetGamepads()
Get a list of currently connected gamepads.
Definition SDL3pp_gamepad.h:1367
constexpr GamepadButton GAMEPAD_BUTTON_TOUCHPAD
PS4/PS5 touchpad button.
Definition SDL3pp_gamepad.h:252
const char * GetPath()
Get the implementation-dependent path for an opened gamepad.
Definition SDL3pp_gamepad.h:1784
const char * GetGamepadStringForType(GamepadType type)
Convert from an GamepadType enum to a string.
Definition SDL3pp_gamepad.h:2218
constexpr GamepadButton GAMEPAD_BUTTON_GUIDE
GAMEPAD_BUTTON_GUIDE.
Definition SDL3pp_gamepad.h:184
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_A
GAMEPAD_BUTTON_LABEL_A.
Definition SDL3pp_gamepad.h:289
constexpr GamepadButton GAMEPAD_BUTTON_COUNT
GAMEPAD_BUTTON_COUNT.
Definition SDL3pp_gamepad.h:270
PowerState GetPowerInfo(int *percent)
Get the battery state of a gamepad.
Definition SDL3pp_gamepad.h:2056
constexpr GamepadBindingType GAMEPAD_BINDTYPE_NONE
GAMEPAD_BINDTYPE_NONE.
Definition SDL3pp_gamepad.h:364
void CloseGamepad(GamepadRaw gamepad)
Close a gamepad previously opened with OpenGamepad().
Definition SDL3pp_gamepad.h:2829
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:178
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_SHOULDER
GAMEPAD_BUTTON_RIGHT_SHOULDER.
Definition SDL3pp_gamepad.h:199
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:1709
constexpr auto RUMBLE_BOOLEAN
Rumble enabled.
Definition SDL3pp_gamepad.h:1720
constexpr auto MONO_LED_BOOLEAN
Mono led enabled.
Definition SDL3pp_gamepad.h:1711
constexpr auto PLAYER_LED_BOOLEAN
Player led enabled.
Definition SDL3pp_gamepad.h:1717
constexpr auto RGB_LED_BOOLEAN
Rgb led enabled.
Definition SDL3pp_gamepad.h:1714
constexpr auto TRIGGER_RUMBLE_BOOLEAN
Trigger rumble enabled.
Definition SDL3pp_gamepad.h:1723
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:399
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
The structure used to identify an SDL gamepad.
Definition SDL3pp_gamepad.h:1067
constexpr Gamepad(Gamepad &&other) noexcept
Move constructor.
Definition SDL3pp_gamepad.h:1083
constexpr Gamepad(GamepadRaw resource) noexcept
Constructs from raw Gamepad.
Definition SDL3pp_gamepad.h:1077
~Gamepad()
Destructor.
Definition SDL3pp_gamepad.h:1105
constexpr Gamepad & operator=(Gamepad &&other) noexcept
Assignment operator.
Definition SDL3pp_gamepad.h:1108
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