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 Gamepad;
73
75using GamepadRaw = SDL_Gamepad*;
76
83
93using GamepadType = SDL_GamepadType;
94
96 SDL_GAMEPAD_TYPE_UNKNOWN;
97
99 SDL_GAMEPAD_TYPE_STANDARD;
100
102 SDL_GAMEPAD_TYPE_XBOX360;
103
105 SDL_GAMEPAD_TYPE_XBOXONE;
106
108 SDL_GAMEPAD_TYPE_PS3;
109
111 SDL_GAMEPAD_TYPE_PS4;
112
114 SDL_GAMEPAD_TYPE_PS5;
115
117 SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO;
118
120 SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT;
121
123 SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
124
126 SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR;
127
128#if SDL_VERSION_ATLEAST(3, 4, 0)
129
131 SDL_GAMEPAD_TYPE_GAMECUBE;
132
133#endif // SDL_VERSION_ATLEAST(3, 4, 0)
134
136 SDL_GAMEPAD_TYPE_COUNT;
137
161using GamepadButton = SDL_GamepadButton;
162
164 SDL_GAMEPAD_BUTTON_INVALID;
165
167 SDL_GAMEPAD_BUTTON_SOUTH;
168
170 SDL_GAMEPAD_BUTTON_EAST;
171
173 SDL_GAMEPAD_BUTTON_WEST;
174
176 SDL_GAMEPAD_BUTTON_NORTH;
177
179 SDL_GAMEPAD_BUTTON_BACK;
180
182 SDL_GAMEPAD_BUTTON_GUIDE;
183
185 SDL_GAMEPAD_BUTTON_START;
186
188 SDL_GAMEPAD_BUTTON_LEFT_STICK;
189
191 SDL_GAMEPAD_BUTTON_RIGHT_STICK;
192
194 SDL_GAMEPAD_BUTTON_LEFT_SHOULDER;
195
197 SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER;
198
200 SDL_GAMEPAD_BUTTON_DPAD_UP;
201
203 SDL_GAMEPAD_BUTTON_DPAD_DOWN;
204
206 SDL_GAMEPAD_BUTTON_DPAD_LEFT;
207
209 SDL_GAMEPAD_BUTTON_DPAD_RIGHT;
210
216constexpr GamepadButton GAMEPAD_BUTTON_MISC1 = SDL_GAMEPAD_BUTTON_MISC1;
217
223 SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1;
224
230 SDL_GAMEPAD_BUTTON_LEFT_PADDLE1;
231
237 SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2;
238
244 SDL_GAMEPAD_BUTTON_LEFT_PADDLE2;
245
247 SDL_GAMEPAD_BUTTON_TOUCHPAD;
248
250 SDL_GAMEPAD_BUTTON_MISC2;
251
253constexpr GamepadButton GAMEPAD_BUTTON_MISC3 = SDL_GAMEPAD_BUTTON_MISC3;
254
256constexpr GamepadButton GAMEPAD_BUTTON_MISC4 = SDL_GAMEPAD_BUTTON_MISC4;
257
259 SDL_GAMEPAD_BUTTON_MISC5;
260
262 SDL_GAMEPAD_BUTTON_MISC6;
263
265 SDL_GAMEPAD_BUTTON_COUNT;
266
278using GamepadButtonLabel = SDL_GamepadButtonLabel;
279
281 SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN;
282
284 SDL_GAMEPAD_BUTTON_LABEL_A;
285
287 SDL_GAMEPAD_BUTTON_LABEL_B;
288
290 SDL_GAMEPAD_BUTTON_LABEL_X;
291
293 SDL_GAMEPAD_BUTTON_LABEL_Y;
294
296 SDL_GAMEPAD_BUTTON_LABEL_CROSS;
297
299 SDL_GAMEPAD_BUTTON_LABEL_CIRCLE;
300
302 SDL_GAMEPAD_BUTTON_LABEL_SQUARE;
303
305 SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE;
306
320using GamepadAxis = SDL_GamepadAxis;
321
323 SDL_GAMEPAD_AXIS_INVALID;
324
326 SDL_GAMEPAD_AXIS_LEFTX;
327
329 SDL_GAMEPAD_AXIS_LEFTY;
330
332 SDL_GAMEPAD_AXIS_RIGHTX;
333
335 SDL_GAMEPAD_AXIS_RIGHTY;
336
338 SDL_GAMEPAD_AXIS_LEFT_TRIGGER;
339
341 SDL_GAMEPAD_AXIS_RIGHT_TRIGGER;
342
344 SDL_GAMEPAD_AXIS_COUNT;
345
356using GamepadBindingType = SDL_GamepadBindingType;
357
359 SDL_GAMEPAD_BINDTYPE_NONE;
360
362 SDL_GAMEPAD_BINDTYPE_BUTTON;
363
365 SDL_GAMEPAD_BINDTYPE_AXIS;
366
368 SDL_GAMEPAD_BINDTYPE_HAT;
369
385using GamepadBinding = SDL_GamepadBinding;
386
394struct Gamepad : ResourceBase<GamepadRaw>
395{
397
405 constexpr explicit Gamepad(GamepadRaw resource) noexcept
406 : ResourceBase(resource)
407 {
408 }
409
411 constexpr Gamepad(const Gamepad& other) = delete;
412
414 constexpr Gamepad(Gamepad&& other) noexcept
415 : Gamepad(other.release())
416 {
417 }
418
419 constexpr Gamepad(const GamepadRef& other) = delete;
420
421 constexpr Gamepad(GamepadRef&& other) = delete;
422
437 Gamepad(JoystickID instance_id);
438
440 ~Gamepad() { SDL_CloseGamepad(get()); }
441
443 constexpr Gamepad& operator=(Gamepad&& other) noexcept
444 {
445 swap(*this, other);
446 return *this;
447 }
448
450 Gamepad& operator=(const Gamepad& other) = delete;
451
461 void Close();
462
481
508
520
533 const char* GetName();
534
547 const char* GetPath();
548
561
574
588 int GetPlayerIndex();
589
603 void SetPlayerIndex(int player_index);
604
619
634
649
662
675 const char* GetSerial();
676
690
702
722 PowerState GetPowerInfo(int* percent);
723
734 bool Connected();
735
756
769
786 bool HasAxis(GamepadAxis axis);
787
814
830 bool HasButton(GamepadButton button);
831
845 bool GetButton(GamepadButton button);
846
860
872 int GetNumTouchpads();
873
888 int GetNumTouchpadFingers(int touchpad);
889
910 void GetTouchpadFinger(int touchpad,
911 int finger,
912 bool* down,
913 float* x,
914 float* y,
915 float* pressure);
916
931 bool HasSensor(SensorType type);
932
947 void SetSensorEnabled(SensorType type, bool enabled);
948
961 bool SensorEnabled(SensorType type);
962
973 float GetSensorDataRate(SensorType type);
974
990 void GetSensorData(SensorType type, float* data, int num_values);
991
1012 void Rumble(Uint16 low_frequency_rumble,
1013 Uint16 high_frequency_rumble,
1014 Uint32 duration_ms);
1015
1042 void RumbleTriggers(Uint16 left_rumble,
1043 Uint16 right_rumble,
1044 Uint32 duration_ms);
1045
1064 void SetLED(Uint8 red, Uint8 green, Uint8 blue);
1065
1077 void SendEffect(const void* data, int size);
1078
1093
1106 const char* GetAppleSFSymbolsNameForAxis(GamepadAxis axis);
1107};
1108
1152{
1153 return SDL_AddGamepadMapping(mapping);
1154}
1155
1194inline int AddGamepadMappingsFromIO(IOStreamRef src, bool closeio)
1195{
1196 return SDL_AddGamepadMappingsFromIO(src, closeio);
1197}
1198
1232{
1233 return SDL_AddGamepadMappingsFromFile(file);
1234}
1235
1247inline void ReloadGamepadMappings() { CheckError(SDL_ReloadGamepadMappings()); }
1248
1260{
1261 int count;
1262 auto data = CheckError(SDL_GetGamepadMappings(&count));
1263 return OwnArray<char*>(data);
1264}
1265
1281{
1282 return StringResult(SDL_GetGamepadMappingForGUID(guid));
1283}
1284
1304{
1305 return StringResult(SDL_GetGamepadMapping(gamepad));
1306}
1307
1309{
1310 return SDL::GetGamepadMapping(get());
1311}
1312
1330inline void SetGamepadMapping(JoystickID instance_id, StringParam mapping)
1331{
1332 CheckError(SDL_SetGamepadMapping(instance_id, mapping));
1333}
1334
1346inline bool HasGamepad() { return SDL_HasGamepad(); }
1347
1362{
1363 int count;
1364 auto r = reinterpret_cast<JoystickID*>(SDL_GetGamepads(&count));
1365 return OwnArray<JoystickID>(r, count);
1366}
1367
1382inline bool IsGamepad(JoystickID instance_id)
1383{
1384 return SDL_IsGamepad(instance_id);
1385}
1386
1403inline const char* GetGamepadNameForID(JoystickID instance_id)
1404{
1405 return SDL_GetGamepadNameForID(instance_id);
1406}
1407
1424inline const char* GetGamepadPathForID(JoystickID instance_id)
1425{
1426 return SDL_GetGamepadPathForID(instance_id);
1427}
1428
1445{
1446 return SDL_GetGamepadPlayerIndexForID(instance_id);
1447}
1448
1466{
1467 return SDL_GetGamepadGUIDForID(instance_id);
1468}
1469
1488{
1489 return SDL_GetGamepadVendorForID(instance_id);
1490}
1491
1510{
1511 return SDL_GetGamepadProductForID(instance_id);
1512}
1513
1532{
1533 return SDL_GetGamepadProductVersionForID(instance_id);
1534}
1535
1553{
1554 return SDL_GetGamepadTypeForID(instance_id);
1555}
1556
1574{
1575 return SDL_GetRealGamepadTypeForID(instance_id);
1576}
1577
1594inline char* GetGamepadMappingForID(JoystickID instance_id)
1595{
1596 return SDL_GetGamepadMappingForID(instance_id);
1597}
1598
1613inline Gamepad OpenGamepad(JoystickID instance_id)
1614{
1615 return Gamepad(instance_id);
1616}
1617
1618inline Gamepad::Gamepad(JoystickID instance_id)
1619 : Gamepad(SDL_OpenGamepad(instance_id))
1620{
1621}
1622
1636{
1637 return {CheckError(SDL_GetGamepadFromID(instance_id))};
1638}
1639
1654{
1655 return {SDL_GetGamepadFromPlayerIndex(player_index)};
1656}
1657
1684{
1685 return {CheckError(SDL_GetGamepadProperties(gamepad))};
1686}
1687
1692
1704
1705constexpr auto MONO_LED_BOOLEAN =
1706 SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN;
1707
1708constexpr auto RGB_LED_BOOLEAN =
1709 SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN;
1710
1711constexpr auto PLAYER_LED_BOOLEAN =
1712 SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN;
1713
1714constexpr auto RUMBLE_BOOLEAN =
1715 SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN;
1716
1718 SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN;
1719
1720} // namespace prop::GamepadCap
1721
1734{
1735 return CheckError(SDL_GetGamepadID(gamepad));
1736}
1737
1739
1753inline const char* GetGamepadName(GamepadRef gamepad)
1754{
1755 return SDL_GetGamepadName(gamepad);
1756}
1757
1758inline const char* Gamepad::GetName() { return SDL::GetGamepadName(get()); }
1759
1773inline const char* GetGamepadPath(GamepadRef gamepad)
1774{
1775 return SDL_GetGamepadPath(gamepad);
1776}
1777
1778inline const char* Gamepad::GetPath() { return SDL::GetGamepadPath(get()); }
1779
1793{
1794 return SDL_GetGamepadType(gamepad);
1795}
1796
1798
1812{
1813 return SDL_GetRealGamepadType(gamepad);
1814}
1815
1820
1836{
1837 return SDL_GetGamepadPlayerIndex(gamepad);
1838}
1839
1841{
1843}
1844
1859inline void SetGamepadPlayerIndex(GamepadRef gamepad, int player_index)
1860{
1861 CheckError(SDL_SetGamepadPlayerIndex(gamepad, player_index));
1862}
1863
1864inline void Gamepad::SetPlayerIndex(int player_index)
1865{
1866 SDL::SetGamepadPlayerIndex(get(), player_index);
1867}
1868
1884{
1885 return SDL_GetGamepadVendor(gamepad);
1886}
1887
1889
1905{
1906 return SDL_GetGamepadProduct(gamepad);
1907}
1908
1910
1926{
1927 return SDL_GetGamepadProductVersion(gamepad);
1928}
1929
1934
1948{
1949 return SDL_GetGamepadFirmwareVersion(gamepad);
1950}
1951
1956
1969inline const char* GetGamepadSerial(GamepadRef gamepad)
1970{
1971 return SDL_GetGamepadSerial(gamepad);
1972}
1973
1974inline const char* Gamepad::GetSerial() { return SDL::GetGamepadSerial(get()); }
1975
1990{
1991 return SDL_GetGamepadSteamHandle(gamepad);
1992}
1993
1998
2011{
2012 return CheckError(SDL_GetGamepadConnectionState(gamepad));
2013}
2014
2019
2039inline PowerState GetGamepadPowerInfo(GamepadRef gamepad, int* percent)
2040{
2041 return SDL_GetGamepadPowerInfo(gamepad, percent);
2042}
2043
2045{
2046 return SDL::GetGamepadPowerInfo(get(), percent);
2047}
2048
2060inline bool GamepadConnected(GamepadRef gamepad)
2061{
2062 return SDL_GamepadConnected(gamepad);
2063}
2064
2066
2088{
2089 return CheckError(SDL_GetGamepadJoystick(gamepad));
2090}
2091
2096
2112inline void SetGamepadEventsEnabled(bool enabled)
2113{
2114 SDL_SetGamepadEventsEnabled(enabled);
2115}
2116
2131inline bool GamepadEventsEnabled() { return SDL_GamepadEventsEnabled(); }
2132
2145{
2146 int count;
2147 auto r = (SDL_GetGamepadBindings(gamepad, &count));
2148 return OwnArray<GamepadBinding*>(r, count);
2149}
2150
2155
2167inline void UpdateGamepads() { SDL_UpdateGamepads(); }
2168
2188{
2189 return SDL_GetGamepadTypeFromString(str);
2190}
2191
2206inline const char* GetGamepadStringForType(GamepadType type)
2207{
2208 return SDL_GetGamepadStringForType(type);
2209}
2210
2233{
2234 return SDL_GetGamepadAxisFromString(str);
2235}
2236
2251inline const char* GetGamepadStringForAxis(GamepadAxis axis)
2252{
2253 return SDL_GetGamepadStringForAxis(axis);
2254}
2255
2273inline bool GamepadHasAxis(GamepadRef gamepad, GamepadAxis axis)
2274{
2275 return SDL_GamepadHasAxis(gamepad, axis);
2276}
2277
2279{
2280 return SDL::GamepadHasAxis(get(), axis);
2281}
2282
2310{
2311 return SDL_GetGamepadAxis(gamepad, axis);
2312}
2313
2315{
2316 return SDL::GetGamepadAxis(get(), axis);
2317}
2318
2338{
2339 return SDL_GetGamepadButtonFromString(str);
2340}
2341
2357{
2358 return SDL_GetGamepadStringForButton(button);
2359}
2360
2377inline bool GamepadHasButton(GamepadRef gamepad, GamepadButton button)
2378{
2379 return SDL_GamepadHasButton(gamepad, button);
2380}
2381
2383{
2384 return SDL::GamepadHasButton(get(), button);
2385}
2386
2401inline bool GetGamepadButton(GamepadRef gamepad, GamepadButton button)
2402{
2403 return SDL_GetGamepadButton(gamepad, button);
2404}
2405
2407{
2408 return SDL::GetGamepadButton(get(), button);
2409}
2410
2425 GamepadButton button)
2426{
2427 return SDL_GetGamepadButtonLabelForType(type, button);
2428}
2429
2444 GamepadButton button)
2445{
2446 return SDL_GetGamepadButtonLabel(gamepad, button);
2447}
2448
2453
2467{
2468 return SDL_GetNumGamepadTouchpads(gamepad);
2469}
2470
2472{
2474}
2475
2491inline int GetNumGamepadTouchpadFingers(GamepadRef gamepad, int touchpad)
2492{
2493 return SDL_GetNumGamepadTouchpadFingers(gamepad, touchpad);
2494}
2495
2496inline int Gamepad::GetNumTouchpadFingers(int touchpad)
2497{
2498 return SDL::GetNumGamepadTouchpadFingers(get(), touchpad);
2499}
2500
2523 int touchpad,
2524 int finger,
2525 bool* down,
2526 float* x,
2527 float* y,
2528 float* pressure)
2529{
2530 CheckError(SDL_GetGamepadTouchpadFinger(
2531 gamepad, touchpad, finger, down, x, y, pressure));
2532}
2533
2534inline void Gamepad::GetTouchpadFinger(int touchpad,
2535 int finger,
2536 bool* down,
2537 float* x,
2538 float* y,
2539 float* pressure)
2540{
2541 SDL::GetGamepadTouchpadFinger(get(), touchpad, finger, down, x, y, pressure);
2542}
2543
2559inline bool GamepadHasSensor(GamepadRef gamepad, SensorType type)
2560{
2561 return SDL_GamepadHasSensor(gamepad, type);
2562}
2563
2565{
2566 return SDL::GamepadHasSensor(get(), type);
2567}
2568
2585 SensorType type,
2586 bool enabled)
2587{
2588 CheckError(SDL_SetGamepadSensorEnabled(gamepad, type, enabled));
2589}
2590
2591inline void Gamepad::SetSensorEnabled(SensorType type, bool enabled)
2592{
2593 SDL::SetGamepadSensorEnabled(get(), type, enabled);
2594}
2595
2610{
2611 return SDL_GamepadSensorEnabled(gamepad, type);
2612}
2613
2615{
2616 return SDL::GamepadSensorEnabled(get(), type);
2617}
2618
2631{
2632 return SDL_GetGamepadSensorDataRate(gamepad, type);
2633}
2634
2636{
2637 return SDL::GetGamepadSensorDataRate(get(), type);
2638}
2639
2657 SensorType type,
2658 float* data,
2659 int num_values)
2660{
2661 CheckError(SDL_GetGamepadSensorData(gamepad, type, data, num_values));
2662}
2663
2664inline void Gamepad::GetSensorData(SensorType type, float* data, int num_values)
2665{
2666 SDL::GetGamepadSensorData(get(), type, data, num_values);
2667}
2668
2690inline void RumbleGamepad(GamepadRef gamepad,
2691 Uint16 low_frequency_rumble,
2692 Uint16 high_frequency_rumble,
2693 Uint32 duration_ms)
2694{
2695 CheckError(SDL_RumbleGamepad(
2696 gamepad, low_frequency_rumble, high_frequency_rumble, duration_ms));
2697}
2698
2699inline void Gamepad::Rumble(Uint16 low_frequency_rumble,
2700 Uint16 high_frequency_rumble,
2701 Uint32 duration_ms)
2702{
2704 get(), low_frequency_rumble, high_frequency_rumble, duration_ms);
2705}
2706
2735 Uint16 left_rumble,
2736 Uint16 right_rumble,
2737 Uint32 duration_ms)
2738{
2739 CheckError(
2740 SDL_RumbleGamepadTriggers(gamepad, left_rumble, right_rumble, duration_ms));
2741}
2742
2743inline void Gamepad::RumbleTriggers(Uint16 left_rumble,
2744 Uint16 right_rumble,
2745 Uint32 duration_ms)
2746{
2747 SDL::RumbleGamepadTriggers(get(), left_rumble, right_rumble, duration_ms);
2748}
2749
2769inline void SetGamepadLED(GamepadRef gamepad,
2770 Uint8 red,
2771 Uint8 green,
2772 Uint8 blue)
2773{
2774 CheckError(SDL_SetGamepadLED(gamepad, red, green, blue));
2775}
2776
2777inline void Gamepad::SetLED(Uint8 red, Uint8 green, Uint8 blue)
2778{
2779 SDL::SetGamepadLED(get(), red, green, blue);
2780}
2781
2794inline void SendGamepadEffect(GamepadRef gamepad, const void* data, int size)
2795{
2796 CheckError(SDL_SendGamepadEffect(gamepad, data, size));
2797}
2798
2799inline void Gamepad::SendEffect(const void* data, int size)
2800{
2801 SDL::SendGamepadEffect(get(), data, size);
2802}
2803
2815inline void CloseGamepad(GamepadRaw gamepad) { SDL_CloseGamepad(gamepad); }
2816
2818
2833 GamepadButton button)
2834{
2835 return SDL_GetGamepadAppleSFSymbolsNameForButton(gamepad, button);
2836}
2837
2842
2857 GamepadAxis axis)
2858{
2859 return SDL_GetGamepadAppleSFSymbolsNameForAxis(gamepad, axis);
2860}
2861
2866
2868
2869} // namespace SDL
2870
2871#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:141
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:44
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:53
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:56
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:199
void GetSensorData(SensorType type, float *data, int num_values)
Get the current state of a gamepad sensor.
Definition SDL3pp_gamepad.h:2664
const char * GetAppleSFSymbolsNameForAxis(GamepadAxis axis)
Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2862
void SetSensorEnabled(SensorType type, bool enabled)
Set whether data reporting for a gamepad sensor is enabled.
Definition SDL3pp_gamepad.h:2591
Uint64 GetGamepadSteamHandle(GamepadRef gamepad)
Get the Steam Input handle of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1989
constexpr GamepadButton GAMEPAD_BUTTON_MISC6
Additional button.
Definition SDL3pp_gamepad.h:261
OwnArray< GamepadBinding * > GetBindings()
Get the SDL joystick layer bindings for a gamepad.
Definition SDL3pp_gamepad.h:2151
constexpr GamepadBindingType GAMEPAD_BINDTYPE_AXIS
GAMEPAD_BINDTYPE_AXIS.
Definition SDL3pp_gamepad.h:364
int GetNumGamepadTouchpadFingers(GamepadRef gamepad, int touchpad)
Get the number of supported simultaneous fingers on a touchpad on a game gamepad.
Definition SDL3pp_gamepad.h:2491
int AddGamepadMappingsFromFile(StringParam file)
Load a set of gamepad mappings from a file.
Definition SDL3pp_gamepad.h:1231
bool HasButton(GamepadButton button)
Query whether a gamepad has a given button.
Definition SDL3pp_gamepad.h:2382
constexpr GamepadType GAMEPAD_TYPE_NINTENDO_SWITCH_PRO
GAMEPAD_TYPE_NINTENDO_SWITCH_PRO.
Definition SDL3pp_gamepad.h:116
constexpr GamepadType GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT
GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT.
Definition SDL3pp_gamepad.h:119
const char * GetGamepadName(GamepadRef gamepad)
Get the implementation-dependent name for an opened gamepad.
Definition SDL3pp_gamepad.h:1753
void Rumble(Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
Start a rumble effect on a gamepad.
Definition SDL3pp_gamepad.h:2699
bool GamepadHasButton(GamepadRef gamepad, GamepadButton button)
Query whether a gamepad has a given button.
Definition SDL3pp_gamepad.h:2377
Uint16 GetProductVersion()
Get the product version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1930
bool GamepadHasSensor(GamepadRef gamepad, SensorType type)
Return whether a gamepad has a particular sensor.
Definition SDL3pp_gamepad.h:2559
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_SQUARE
GAMEPAD_BUTTON_LABEL_SQUARE.
Definition SDL3pp_gamepad.h:301
constexpr GamepadAxis GAMEPAD_AXIS_RIGHTX
GAMEPAD_AXIS_RIGHTX.
Definition SDL3pp_gamepad.h:331
PropertiesRef GetGamepadProperties(GamepadRef gamepad)
Get the properties associated with an opened gamepad.
Definition SDL3pp_gamepad.h:1683
constexpr GamepadButton GAMEPAD_BUTTON_MISC4
Additional button (e.g. Nintendo GameCube right trigger click).
Definition SDL3pp_gamepad.h:256
ResourceRef< Gamepad > GamepadRef
Reference for Gamepad.
Definition SDL3pp_gamepad.h:82
GamepadRef GetGamepadFromPlayerIndex(int player_index)
Get the Gamepad associated with a player index.
Definition SDL3pp_gamepad.h:1653
constexpr GamepadAxis GAMEPAD_AXIS_LEFTY
GAMEPAD_AXIS_LEFTY.
Definition SDL3pp_gamepad.h:328
GamepadAxis GetGamepadAxisFromString(StringParam str)
Convert a string into GamepadAxis enum.
Definition SDL3pp_gamepad.h:2232
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_PADDLE2
Lower or secondary paddle, under your left hand (e.g.
Definition SDL3pp_gamepad.h:243
const char * GetAppleSFSymbolsNameForButton(GamepadButton button)
Return the sfSymbolsName for a given button on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2838
GamepadButton GetGamepadButtonFromString(StringParam str)
Convert a string into an GamepadButton enum.
Definition SDL3pp_gamepad.h:2337
GamepadRef GetGamepadFromID(JoystickID instance_id)
Get the Gamepad associated with a joystick instance ID, if it has been opened.
Definition SDL3pp_gamepad.h:1635
constexpr GamepadBindingType GAMEPAD_BINDTYPE_BUTTON
GAMEPAD_BINDTYPE_BUTTON.
Definition SDL3pp_gamepad.h:361
SDL_GamepadType GamepadType
Standard gamepad types.
Definition SDL3pp_gamepad.h:93
Uint16 GetVendor()
Get the USB vendor ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1888
float GetGamepadSensorDataRate(GamepadRef gamepad, SensorType type)
Get the data rate (number of events per second) of a gamepad sensor.
Definition SDL3pp_gamepad.h:2630
GamepadType GetType()
Get the type of an opened gamepad.
Definition SDL3pp_gamepad.h:1797
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_UP
GAMEPAD_BUTTON_DPAD_UP.
Definition SDL3pp_gamepad.h:199
void SetGamepadLED(GamepadRef gamepad, Uint8 red, Uint8 green, Uint8 blue)
Update a gamepad's LED color.
Definition SDL3pp_gamepad.h:2769
Uint16 GetGamepadProduct(GamepadRef gamepad)
Get the USB product ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1904
constexpr GamepadType GAMEPAD_TYPE_GAMECUBE
GAMEPAD_TYPE_GAMECUBE.
Definition SDL3pp_gamepad.h:130
bool HasAxis(GamepadAxis axis)
Query whether a gamepad has a given axis.
Definition SDL3pp_gamepad.h:2278
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_B
GAMEPAD_BUTTON_LABEL_B.
Definition SDL3pp_gamepad.h:286
bool GamepadEventsEnabled()
Query the state of gamepad event processing.
Definition SDL3pp_gamepad.h:2131
SDL_Gamepad * GamepadRaw
Alias to raw representation for Gamepad.
Definition SDL3pp_gamepad.h:75
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_SHOULDER
GAMEPAD_BUTTON_LEFT_SHOULDER.
Definition SDL3pp_gamepad.h:193
constexpr GamepadType GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR
GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR.
Definition SDL3pp_gamepad.h:125
GamepadType GetRealGamepadTypeForID(JoystickID instance_id)
Get the type of a gamepad, ignoring any mapping override.
Definition SDL3pp_gamepad.h:1573
GamepadButtonLabel GetButtonLabel(GamepadButton button)
Get the label of a button on a gamepad.
Definition SDL3pp_gamepad.h:2449
void GetGamepadSensorData(GamepadRef gamepad, SensorType type, float *data, int num_values)
Get the current state of a gamepad sensor.
Definition SDL3pp_gamepad.h:2656
Uint16 GetGamepadVendorForID(JoystickID instance_id)
Get the USB vendor ID of a gamepad, if available.
Definition SDL3pp_gamepad.h:1487
bool Connected()
Check if a gamepad has been opened and is currently connected.
Definition SDL3pp_gamepad.h:2065
Uint16 GetGamepadFirmwareVersion(GamepadRef gamepad)
Get the firmware version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1947
Uint16 GetGamepadProductForID(JoystickID instance_id)
Get the USB product ID of a gamepad, if available.
Definition SDL3pp_gamepad.h:1509
PowerState GetPowerInfo(int *percent)
Get the battery state of a gamepad.
Definition SDL3pp_gamepad.h:2044
SDL_GamepadButtonLabel GamepadButtonLabel
The set of gamepad button labels.
Definition SDL3pp_gamepad.h:278
int GetNumTouchpads()
Get the number of touchpads on a gamepad.
Definition SDL3pp_gamepad.h:2471
int GetNumTouchpadFingers(int touchpad)
Get the number of supported simultaneous fingers on a touchpad on a game gamepad.
Definition SDL3pp_gamepad.h:2496
const char * GetSerial()
Get the serial number of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1974
PropertiesRef GetProperties()
Get the properties associated with an opened gamepad.
Definition SDL3pp_gamepad.h:1688
void SetGamepadSensorEnabled(GamepadRef gamepad, SensorType type, bool enabled)
Set whether data reporting for a gamepad sensor is enabled.
Definition SDL3pp_gamepad.h:2584
const char * GetGamepadAppleSFSymbolsNameForAxis(GamepadRef gamepad, GamepadAxis axis)
Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2856
bool GamepadSensorEnabled(GamepadRef gamepad, SensorType type)
Query whether sensor data reporting is enabled for a gamepad.
Definition SDL3pp_gamepad.h:2609
const char * GetName()
Get the implementation-dependent name for an opened gamepad.
Definition SDL3pp_gamepad.h:1758
const char * GetGamepadNameForID(JoystickID instance_id)
Get the implementation dependent name of a gamepad.
Definition SDL3pp_gamepad.h:1403
Sint16 GetGamepadAxis(GamepadRef gamepad, GamepadAxis axis)
Get the current state of an axis control on a gamepad.
Definition SDL3pp_gamepad.h:2309
OwnArray< char * > GetGamepadMappings()
Get the current gamepad mappings.
Definition SDL3pp_gamepad.h:1259
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_LEFT
GAMEPAD_BUTTON_DPAD_LEFT.
Definition SDL3pp_gamepad.h:205
bool GetGamepadButton(GamepadRef gamepad, GamepadButton button)
Get the current state of a button on a gamepad.
Definition SDL3pp_gamepad.h:2401
GUID GetGamepadGUIDForID(JoystickID instance_id)
Get the implementation-dependent GUID of a gamepad.
Definition SDL3pp_gamepad.h:1465
constexpr GamepadAxis GAMEPAD_AXIS_RIGHT_TRIGGER
GAMEPAD_AXIS_RIGHT_TRIGGER.
Definition SDL3pp_gamepad.h:340
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:2534
void SetPlayerIndex(int player_index)
Set the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1864
constexpr GamepadBindingType GAMEPAD_BINDTYPE_HAT
GAMEPAD_BINDTYPE_HAT.
Definition SDL3pp_gamepad.h:367
bool GamepadConnected(GamepadRef gamepad)
Check if a gamepad has been opened and is currently connected.
Definition SDL3pp_gamepad.h:2060
constexpr GamepadType GAMEPAD_TYPE_COUNT
GAMEPAD_TYPE_COUNT.
Definition SDL3pp_gamepad.h:135
constexpr GamepadType GAMEPAD_TYPE_XBOXONE
GAMEPAD_TYPE_XBOXONE.
Definition SDL3pp_gamepad.h:104
void RumbleTriggers(Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms)
Start a rumble effect in the gamepad's triggers.
Definition SDL3pp_gamepad.h:2743
JoystickID GetID()
Get the instance ID of an opened gamepad.
Definition SDL3pp_gamepad.h:1738
constexpr GamepadAxis GAMEPAD_AXIS_LEFTX
GAMEPAD_AXIS_LEFTX.
Definition SDL3pp_gamepad.h:325
void SetGamepadPlayerIndex(GamepadRef gamepad, int player_index)
Set the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1859
StringResult GetGamepadMapping(GamepadRef gamepad)
Get the current mapping of a gamepad.
Definition SDL3pp_gamepad.h:1303
constexpr GamepadButton GAMEPAD_BUTTON_EAST
Right face button (e.g. Xbox B button).
Definition SDL3pp_gamepad.h:169
constexpr GamepadType GAMEPAD_TYPE_STANDARD
GAMEPAD_TYPE_STANDARD.
Definition SDL3pp_gamepad.h:98
void SendEffect(const void *data, int size)
Send a gamepad specific effect packet.
Definition SDL3pp_gamepad.h:2799
constexpr GamepadType GAMEPAD_TYPE_PS3
GAMEPAD_TYPE_PS3.
Definition SDL3pp_gamepad.h:107
constexpr GamepadType GAMEPAD_TYPE_PS4
GAMEPAD_TYPE_PS4.
Definition SDL3pp_gamepad.h:110
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_PADDLE2
Lower or secondary paddle, under your right hand (e.g.
Definition SDL3pp_gamepad.h:236
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_CROSS
GAMEPAD_BUTTON_LABEL_CROSS.
Definition SDL3pp_gamepad.h:295
StringResult GetMapping()
Get the current mapping of a gamepad.
Definition SDL3pp_gamepad.h:1308
void SendGamepadEffect(GamepadRef gamepad, const void *data, int size)
Send a gamepad specific effect packet.
Definition SDL3pp_gamepad.h:2794
const char * GetGamepadSerial(GamepadRef gamepad)
Get the serial number of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1969
int AddGamepadMappingsFromIO(IOStreamRef src, bool closeio)
Load a set of gamepad mappings from an IOStream.
Definition SDL3pp_gamepad.h:1194
constexpr GamepadButton GAMEPAD_BUTTON_SOUTH
Bottom face button (e.g. Xbox A button).
Definition SDL3pp_gamepad.h:166
constexpr GamepadAxis GAMEPAD_AXIS_LEFT_TRIGGER
GAMEPAD_AXIS_LEFT_TRIGGER.
Definition SDL3pp_gamepad.h:337
Uint16 GetGamepadProductVersionForID(JoystickID instance_id)
Get the product version of a gamepad, if available.
Definition SDL3pp_gamepad.h:1531
SDL_GamepadAxis GamepadAxis
The list of axes available on a gamepad.
Definition SDL3pp_gamepad.h:320
int GetGamepadPlayerIndexForID(JoystickID instance_id)
Get the player index of a gamepad.
Definition SDL3pp_gamepad.h:1444
JoystickConnectionState GetConnectionState()
Get the connection state of a gamepad.
Definition SDL3pp_gamepad.h:2015
const char * GetGamepadPathForID(JoystickID instance_id)
Get the implementation dependent path of a gamepad.
Definition SDL3pp_gamepad.h:1424
void Close()
Close a gamepad previously opened with OpenGamepad().
Definition SDL3pp_gamepad.h:2817
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:2690
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_UNKNOWN
GAMEPAD_BUTTON_LABEL_UNKNOWN.
Definition SDL3pp_gamepad.h:280
void SetLED(Uint8 red, Uint8 green, Uint8 blue)
Update a gamepad's LED color.
Definition SDL3pp_gamepad.h:2777
const char * GetGamepadStringForAxis(GamepadAxis axis)
Convert from an GamepadAxis enum to a string.
Definition SDL3pp_gamepad.h:2251
JoystickID GetGamepadID(GamepadRef gamepad)
Get the instance ID of an opened gamepad.
Definition SDL3pp_gamepad.h:1733
GamepadType GetRealType()
Get the type of an opened gamepad, ignoring any mapping override.
Definition SDL3pp_gamepad.h:1816
Sint16 GetAxis(GamepadAxis axis)
Get the current state of an axis control on a gamepad.
Definition SDL3pp_gamepad.h:2314
bool HasSensor(SensorType type)
Return whether a gamepad has a particular sensor.
Definition SDL3pp_gamepad.h:2564
constexpr GamepadButton GAMEPAD_BUTTON_BACK
GAMEPAD_BUTTON_BACK.
Definition SDL3pp_gamepad.h:178
JoystickConnectionState GetGamepadConnectionState(GamepadRef gamepad)
Get the connection state of a gamepad.
Definition SDL3pp_gamepad.h:2010
Uint16 GetProduct()
Get the USB product ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1909
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:2522
StringResult GetGamepadMappingForGUID(GUID guid)
Get the gamepad mapping string for a given GUID.
Definition SDL3pp_gamepad.h:1280
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_RIGHT
GAMEPAD_BUTTON_DPAD_RIGHT.
Definition SDL3pp_gamepad.h:208
Uint16 GetFirmwareVersion()
Get the firmware version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1952
Uint64 GetSteamHandle()
Get the Steam Input handle of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1994
int GetGamepadPlayerIndex(GamepadRef gamepad)
Get the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1835
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_X
GAMEPAD_BUTTON_LABEL_X.
Definition SDL3pp_gamepad.h:289
GamepadButtonLabel GetGamepadButtonLabelForType(GamepadType type, GamepadButton button)
Get the label of a button on a gamepad.
Definition SDL3pp_gamepad.h:2424
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_PADDLE1
Upper or primary paddle, under your right hand (e.g.
Definition SDL3pp_gamepad.h:222
GamepadButtonLabel GetGamepadButtonLabel(GamepadRef gamepad, GamepadButton button)
Get the label of a button on a gamepad.
Definition SDL3pp_gamepad.h:2443
int GetNumGamepadTouchpads(GamepadRef gamepad)
Get the number of touchpads on a gamepad.
Definition SDL3pp_gamepad.h:2466
const char * GetGamepadAppleSFSymbolsNameForButton(GamepadRef gamepad, GamepadButton button)
Return the sfSymbolsName for a given button on a gamepad on Apple platforms.
Definition SDL3pp_gamepad.h:2832
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:1151
constexpr GamepadButton GAMEPAD_BUTTON_INVALID
GAMEPAD_BUTTON_INVALID.
Definition SDL3pp_gamepad.h:163
SDL_GamepadBindingType GamepadBindingType
Types of gamepad control bindings.
Definition SDL3pp_gamepad.h:356
constexpr GamepadAxis GAMEPAD_AXIS_RIGHTY
GAMEPAD_AXIS_RIGHTY.
Definition SDL3pp_gamepad.h:334
GamepadType GetRealGamepadType(GamepadRef gamepad)
Get the type of an opened gamepad, ignoring any mapping override.
Definition SDL3pp_gamepad.h:1811
const char * GetGamepadPath(GamepadRef gamepad)
Get the implementation-dependent path for an opened gamepad.
Definition SDL3pp_gamepad.h:1773
GamepadType GetGamepadTypeForID(JoystickID instance_id)
Get the type of a gamepad.
Definition SDL3pp_gamepad.h:1552
float GetSensorDataRate(SensorType type)
Get the data rate (number of events per second) of a gamepad sensor.
Definition SDL3pp_gamepad.h:2635
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_CIRCLE
GAMEPAD_BUTTON_LABEL_CIRCLE.
Definition SDL3pp_gamepad.h:298
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_TRIANGLE
GAMEPAD_BUTTON_LABEL_TRIANGLE.
Definition SDL3pp_gamepad.h:304
constexpr GamepadButton GAMEPAD_BUTTON_MISC3
Additional button (e.g. Nintendo GameCube left trigger click).
Definition SDL3pp_gamepad.h:253
char * GetGamepadMappingForID(JoystickID instance_id)
Get the mapping of a gamepad.
Definition SDL3pp_gamepad.h:1594
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_PADDLE1
Upper or primary paddle, under your left hand (e.g.
Definition SDL3pp_gamepad.h:229
bool GamepadHasAxis(GamepadRef gamepad, GamepadAxis axis)
Query whether a gamepad has a given axis.
Definition SDL3pp_gamepad.h:2273
bool HasGamepad()
Return whether a gamepad is currently connected.
Definition SDL3pp_gamepad.h:1346
Uint16 GetGamepadProductVersion(GamepadRef gamepad)
Get the product version of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1925
void ReloadGamepadMappings()
Reinitialize the SDL mapping database to its initial state.
Definition SDL3pp_gamepad.h:1247
Uint16 GetGamepadVendor(GamepadRef gamepad)
Get the USB vendor ID of an opened gamepad, if available.
Definition SDL3pp_gamepad.h:1883
constexpr GamepadButton GAMEPAD_BUTTON_START
GAMEPAD_BUTTON_START.
Definition SDL3pp_gamepad.h:184
const char * GetGamepadStringForButton(GamepadButton button)
Convert from an GamepadButton enum to a string.
Definition SDL3pp_gamepad.h:2356
JoystickRef GetGamepadJoystick(GamepadRef gamepad)
Get the underlying joystick from a gamepad.
Definition SDL3pp_gamepad.h:2087
constexpr GamepadButton GAMEPAD_BUTTON_MISC1
Additional button (e.g.
Definition SDL3pp_gamepad.h:216
constexpr GamepadAxis GAMEPAD_AXIS_COUNT
GAMEPAD_AXIS_COUNT.
Definition SDL3pp_gamepad.h:343
constexpr GamepadAxis GAMEPAD_AXIS_INVALID
GAMEPAD_AXIS_INVALID.
Definition SDL3pp_gamepad.h:322
GamepadType GetGamepadTypeFromString(StringParam str)
Convert a string into GamepadType enum.
Definition SDL3pp_gamepad.h:2187
constexpr GamepadButton GAMEPAD_BUTTON_WEST
Left face button (e.g. Xbox X button).
Definition SDL3pp_gamepad.h:172
OwnArray< GamepadBinding * > GetGamepadBindings(GamepadRef gamepad)
Get the SDL joystick layer bindings for a gamepad.
Definition SDL3pp_gamepad.h:2144
PowerState GetGamepadPowerInfo(GamepadRef gamepad, int *percent)
Get the battery state of a gamepad.
Definition SDL3pp_gamepad.h:2039
bool IsGamepad(JoystickID instance_id)
Check if the given joystick is supported by the gamepad interface.
Definition SDL3pp_gamepad.h:1382
constexpr GamepadType GAMEPAD_TYPE_XBOX360
GAMEPAD_TYPE_XBOX360.
Definition SDL3pp_gamepad.h:101
constexpr GamepadType GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT
GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT.
Definition SDL3pp_gamepad.h:122
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:2734
constexpr GamepadButton GAMEPAD_BUTTON_LEFT_STICK
GAMEPAD_BUTTON_LEFT_STICK.
Definition SDL3pp_gamepad.h:187
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_STICK
GAMEPAD_BUTTON_RIGHT_STICK.
Definition SDL3pp_gamepad.h:190
constexpr GamepadButton GAMEPAD_BUTTON_DPAD_DOWN
GAMEPAD_BUTTON_DPAD_DOWN.
Definition SDL3pp_gamepad.h:202
constexpr GamepadButton GAMEPAD_BUTTON_MISC5
Additional button.
Definition SDL3pp_gamepad.h:258
SDL_GamepadButton GamepadButton
The list of buttons available on a gamepad.
Definition SDL3pp_gamepad.h:161
void SetGamepadMapping(JoystickID instance_id, StringParam mapping)
Set the current mapping of a joystick or gamepad.
Definition SDL3pp_gamepad.h:1330
void SetGamepadEventsEnabled(bool enabled)
Set the state of gamepad event processing.
Definition SDL3pp_gamepad.h:2112
constexpr GamepadType GAMEPAD_TYPE_PS5
GAMEPAD_TYPE_PS5.
Definition SDL3pp_gamepad.h:113
constexpr GamepadButton GAMEPAD_BUTTON_MISC2
Additional button.
Definition SDL3pp_gamepad.h:249
GamepadType GetGamepadType(GamepadRef gamepad)
Get the type of an opened gamepad.
Definition SDL3pp_gamepad.h:1792
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_Y
GAMEPAD_BUTTON_LABEL_Y.
Definition SDL3pp_gamepad.h:292
bool GetButton(GamepadButton button)
Get the current state of a button on a gamepad.
Definition SDL3pp_gamepad.h:2406
JoystickRef GetJoystick()
Get the underlying joystick from a gamepad.
Definition SDL3pp_gamepad.h:2092
Gamepad OpenGamepad(JoystickID instance_id)
Open a gamepad for use.
Definition SDL3pp_gamepad.h:1613
void UpdateGamepads()
Manually pump gamepad updates if not using the loop.
Definition SDL3pp_gamepad.h:2167
SDL_GamepadBinding GamepadBinding
A mapping between one joystick input to a gamepad control.
Definition SDL3pp_gamepad.h:385
OwnArray< JoystickID > GetGamepads()
Get a list of currently connected gamepads.
Definition SDL3pp_gamepad.h:1361
constexpr GamepadButton GAMEPAD_BUTTON_TOUCHPAD
PS4/PS5 touchpad button.
Definition SDL3pp_gamepad.h:246
const char * GetGamepadStringForType(GamepadType type)
Convert from an GamepadType enum to a string.
Definition SDL3pp_gamepad.h:2206
constexpr GamepadButton GAMEPAD_BUTTON_GUIDE
GAMEPAD_BUTTON_GUIDE.
Definition SDL3pp_gamepad.h:181
int GetPlayerIndex()
Get the player index of an opened gamepad.
Definition SDL3pp_gamepad.h:1840
bool SensorEnabled(SensorType type)
Query whether sensor data reporting is enabled for a gamepad.
Definition SDL3pp_gamepad.h:2614
constexpr GamepadButtonLabel GAMEPAD_BUTTON_LABEL_A
GAMEPAD_BUTTON_LABEL_A.
Definition SDL3pp_gamepad.h:283
constexpr GamepadButton GAMEPAD_BUTTON_COUNT
GAMEPAD_BUTTON_COUNT.
Definition SDL3pp_gamepad.h:264
const char * GetPath()
Get the implementation-dependent path for an opened gamepad.
Definition SDL3pp_gamepad.h:1778
constexpr GamepadBindingType GAMEPAD_BINDTYPE_NONE
GAMEPAD_BINDTYPE_NONE.
Definition SDL3pp_gamepad.h:358
void CloseGamepad(GamepadRaw gamepad)
Close a gamepad previously opened with OpenGamepad().
Definition SDL3pp_gamepad.h:2815
constexpr GamepadType GAMEPAD_TYPE_UNKNOWN
GAMEPAD_TYPE_UNKNOWN.
Definition SDL3pp_gamepad.h:95
constexpr GamepadButton GAMEPAD_BUTTON_NORTH
Top face button (e.g. Xbox Y button).
Definition SDL3pp_gamepad.h:175
constexpr GamepadButton GAMEPAD_BUTTON_RIGHT_SHOULDER
GAMEPAD_BUTTON_RIGHT_SHOULDER.
Definition SDL3pp_gamepad.h:196
ResourceRef< IOStream > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:34
SDL_JoystickConnectionState JoystickConnectionState
Possible connection states for a joystick device.
Definition SDL3pp_joystick.h:363
ResourceRef< Joystick > JoystickRef
Reference for Joystick.
Definition SDL3pp_joystick.h:68
SDL_PowerState PowerState
The basic state for the system's power supply.
Definition SDL3pp_power.h:38
ResourceRef< Properties > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:54
SDL_SensorType SensorType
The different sensors defined by SDL.
Definition SDL3pp_sensor.h:102
::Uint16 Uint16
An unsigned 16-bit integer type.
Definition SDL3pp_stdinc.h:264
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:290
::Sint16 Sint16
A signed 16-bit integer type.
Definition SDL3pp_stdinc.h:251
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition SDL3pp_stdinc.h:238
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition SDL3pp_stdinc.h:320
Gamepad capability properties.
Definition SDL3pp_gamepad.h:1703
constexpr auto RUMBLE_BOOLEAN
Rumble enabled.
Definition SDL3pp_gamepad.h:1714
constexpr auto MONO_LED_BOOLEAN
Mono led enabled.
Definition SDL3pp_gamepad.h:1705
constexpr auto PLAYER_LED_BOOLEAN
Player led enabled.
Definition SDL3pp_gamepad.h:1711
constexpr auto RGB_LED_BOOLEAN
Rgb led enabled.
Definition SDL3pp_gamepad.h:1708
constexpr auto TRIGGER_RUMBLE_BOOLEAN
Trigger rumble enabled.
Definition SDL3pp_gamepad.h:1717
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
The structure used to identify an SDL gamepad.
Definition SDL3pp_gamepad.h:395
Gamepad & operator=(const Gamepad &other)=delete
Assignment operator.
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
constexpr Gamepad(Gamepad &&other) noexcept
Move constructor.
Definition SDL3pp_gamepad.h:414
constexpr Gamepad(GamepadRaw resource) noexcept
Constructs from raw Gamepad.
Definition SDL3pp_gamepad.h:405
~Gamepad()
Destructor.
Definition SDL3pp_gamepad.h:440
constexpr Gamepad & operator=(Gamepad &&other) noexcept
Assignment operator.
Definition SDL3pp_gamepad.h:443
constexpr Gamepad(const Gamepad &other)=delete
Copy constructor.
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:156
A simple std::string-like interface for SDL allocated strings.
Definition SDL3pp_strings.h:147