SDL 3.0
SDL_gamepad.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * \file SDL_gamepad.h
24 *
25 * Include file for SDL gamepad event handling
26 */
27
28#ifndef SDL_gamepad_h_
29#define SDL_gamepad_h_
30
31#include <SDL3/SDL_stdinc.h>
32#include <SDL3/SDL_error.h>
33#include <SDL3/SDL_rwops.h>
34#include <SDL3/SDL_sensor.h>
35#include <SDL3/SDL_joystick.h>
36
37#include <SDL3/SDL_begin_code.h>
38/* Set up for C function definitions, even when using C++ */
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43/**
44 * \file SDL_gamepad.h
45 *
46 * In order to use these functions, SDL_Init() must have been called
47 * with the ::SDL_INIT_GAMEPAD flag. This causes SDL to scan the system
48 * for gamepads, and load appropriate drivers.
49 *
50 * If you would like to receive gamepad updates while the application
51 * is in the background, you should set the following hint before calling
52 * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
53 */
54
55/**
56 * The structure used to identify an SDL gamepad
57 */
58struct SDL_Gamepad;
59typedef struct SDL_Gamepad SDL_Gamepad;
60
61typedef enum
62{
78
79/**
80 * The list of buttons available on a gamepad
81 */
82typedef enum
83{
100 SDL_GAMEPAD_BUTTON_MISC1, /* Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button */
101 SDL_GAMEPAD_BUTTON_PADDLE1, /* Xbox Elite paddle P1 (upper left, facing the back) */
102 SDL_GAMEPAD_BUTTON_PADDLE2, /* Xbox Elite paddle P3 (upper right, facing the back) */
103 SDL_GAMEPAD_BUTTON_PADDLE3, /* Xbox Elite paddle P2 (lower left, facing the back) */
104 SDL_GAMEPAD_BUTTON_PADDLE4, /* Xbox Elite paddle P4 (lower right, facing the back) */
105 SDL_GAMEPAD_BUTTON_TOUCHPAD, /* PS4/PS5 touchpad button */
108
109/**
110 * The list of axes available on a gamepad
111 *
112 * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
113 * and are centered within ~8000 of zero, though advanced UI will allow users to set
114 * or autodetect the dead zone, which varies between gamepads.
115 *
116 * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
117 */
118typedef enum
119{
129
130typedef enum
131{
137
138/**
139 * Get the SDL joystick layer binding for this gamepad button/axis mapping
140 */
141typedef struct SDL_GamepadBinding
142{
144 union
145 {
147 int axis;
148 struct {
149 int hat;
153
155
156
157/**
158 * Add support for gamepads that SDL is unaware of or change the binding of an
159 * existing gamepad.
160 *
161 * The mapping string has the format "GUID,name,mapping", where GUID is the
162 * string value from SDL_GetJoystickGUIDString(), name is the human readable
163 * string for the device and mappings are gamepad mappings to joystick ones.
164 * Under Windows there is a reserved GUID of "xinput" that covers all XInput
165 * devices. The mapping format for joystick is: {| |bX |a joystick button,
166 * index X |- |hX.Y |hat X with value Y |- |aX |axis X of the joystick |}
167 * Buttons can be used as a gamepad axes and vice versa.
168 *
169 * This string shows an example of a valid mapping for a gamepad:
170 *
171 * ```c
172 * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"
173 * ```
174 *
175 * \param mappingString the mapping string
176 * \returns 1 if a new mapping is added, 0 if an existing mapping is updated,
177 * -1 on error; call SDL_GetError() for more information.
178 *
179 * \since This function is available since SDL 3.0.0.
180 *
181 * \sa SDL_GetGamepadMapping
182 * \sa SDL_GetGamepadMappingForGUID
183 */
184extern DECLSPEC int SDLCALL SDL_AddGamepadMapping(const char *mappingString);
185
186/**
187 * Load a set of gamepad mappings from a seekable SDL data stream.
188 *
189 * You can call this function several times, if needed, to load different
190 * database files.
191 *
192 * If a new mapping is loaded for an already known gamepad GUID, the later
193 * version will overwrite the one currently loaded.
194 *
195 * Mappings not belonging to the current platform or with no platform field
196 * specified will be ignored (i.e. mappings for Linux will be ignored in
197 * Windows, etc).
198 *
199 * This function will load the text database entirely in memory before
200 * processing it, so take this into consideration if you are in a memory
201 * constrained environment.
202 *
203 * \param rw the data stream for the mappings to be added
204 * \param freerw non-zero to close the stream after being read
205 * \returns the number of mappings added or -1 on error; call SDL_GetError()
206 * for more information.
207 *
208 * \since This function is available since SDL 3.0.0.
209 *
210 * \sa SDL_AddGamepadMapping
211 * \sa SDL_AddGamepadMappingsFromFile
212 * \sa SDL_GetGamepadMappingForGUID
213 */
214extern DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromRW(SDL_RWops *rw, int freerw);
215
216/**
217 * Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
218 *
219 * Convenience macro.
220 */
221#define SDL_AddGamepadMappingsFromFile(file) SDL_AddGamepadMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
222
223/**
224 * Get the number of mappings installed.
225 *
226 * \returns the number of mappings.
227 *
228 * \since This function is available since SDL 3.0.0.
229 */
230extern DECLSPEC int SDLCALL SDL_GetNumGamepadMappings(void);
231
232/**
233 * Get the mapping at a particular index.
234 *
235 * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
236 * the index is out of range.
237 *
238 * \since This function is available since SDL 3.0.0.
239 */
240extern DECLSPEC char * SDLCALL SDL_GetGamepadMappingForIndex(int mapping_index);
241
242/**
243 * Get the gamepad mapping string for a given GUID.
244 *
245 * The returned string must be freed with SDL_free().
246 *
247 * \param guid a structure containing the GUID for which a mapping is desired
248 * \returns a mapping string or NULL on error; call SDL_GetError() for more
249 * information.
250 *
251 * \since This function is available since SDL 3.0.0.
252 *
253 * \sa SDL_GetJoystickInstanceGUID
254 * \sa SDL_GetJoystickGUID
255 */
256extern DECLSPEC char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_JoystickGUID guid);
257
258/**
259 * Get the current mapping of a gamepad.
260 *
261 * The returned string must be freed with SDL_free().
262 *
263 * Details about mappings are discussed with SDL_AddGamepadMapping().
264 *
265 * \param gamepad the gamepad you want to get the current mapping for
266 * \returns a string that has the gamepad's mapping or NULL if no mapping is
267 * available; call SDL_GetError() for more information.
268 *
269 * \since This function is available since SDL 3.0.0.
270 *
271 * \sa SDL_AddGamepadMapping
272 * \sa SDL_GetGamepadMappingForGUID
273 */
274extern DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad);
275
276/**
277 * Get a list of currently connected gamepads.
278 *
279 * \param count a pointer filled in with the number of gamepads returned
280 * \returns a 0 terminated array of joystick instance IDs which should be
281 * freed with SDL_free(), or NULL on error; call SDL_GetError() for
282 * more details.
283 *
284 * \since This function is available since SDL 3.0.0.
285 *
286 * \sa SDL_OpenGamepad
287 */
288extern DECLSPEC SDL_JoystickID *SDLCALL SDL_GetGamepads(int *count);
289
290/**
291 * Check if the given joystick is supported by the gamepad interface.
292 *
293 * \param instance_id the joystick instance ID
294 * \returns SDL_TRUE if the given joystick is supported by the gamepad
295 * interface, SDL_FALSE if it isn't or it's an invalid index.
296 *
297 * \since This function is available since SDL 3.0.0.
298 *
299 * \sa SDL_GetGamepadNameForIndex
300 * \sa SDL_OpenGamepad
301 */
302extern DECLSPEC SDL_bool SDLCALL SDL_IsGamepad(SDL_JoystickID instance_id);
303
304/**
305 * Get the implementation dependent name of a gamepad.
306 *
307 * This can be called before any gamepads are opened.
308 *
309 * \param instance_id the joystick instance ID
310 * \returns the name of the selected gamepad. If no name can be found, this
311 * function returns NULL; call SDL_GetError() for more information.
312 *
313 * \since This function is available since SDL 3.0.0.
314 *
315 * \sa SDL_GetGamepadName
316 * \sa SDL_OpenGamepad
317 */
318extern DECLSPEC const char *SDLCALL SDL_GetGamepadInstanceName(SDL_JoystickID instance_id);
319
320/**
321 * Get the implementation dependent path of a gamepad.
322 *
323 * This can be called before any gamepads are opened.
324 *
325 * \param instance_id the joystick instance ID
326 * \returns the path of the selected gamepad. If no path can be found, this
327 * function returns NULL; call SDL_GetError() for more information.
328 *
329 * \since This function is available since SDL 3.0.0.
330 *
331 * \sa SDL_GetGamepadPath
332 * \sa SDL_OpenGamepad
333 */
334extern DECLSPEC const char *SDLCALL SDL_GetGamepadInstancePath(SDL_JoystickID instance_id);
335
336/**
337 * Get the player index of a gamepad.
338 *
339 * This can be called before any gamepads are opened.
340 *
341 * \param instance_id the joystick instance ID
342 * \returns the player index of a gamepad, or -1 if it's not available
343 *
344 * \since This function is available since SDL 3.0.0.
345 *
346 * \sa SDL_GetGamepadPlayerIndex
347 * \sa SDL_OpenGamepad
348 */
349extern DECLSPEC int SDLCALL SDL_GetGamepadInstancePlayerIndex(SDL_JoystickID instance_id);
350
351/**
352 * Get the implementation-dependent GUID of a gamepad.
353 *
354 * This can be called before any gamepads are opened.
355 *
356 * \param instance_id the joystick instance ID
357 * \returns the GUID of the selected gamepad. If called on an invalid index,
358 * this function returns a zero GUID
359 *
360 * \since This function is available since SDL 3.0.0.
361 *
362 * \sa SDL_GetGamepadGUID
363 * \sa SDL_GetGamepadGUIDString
364 */
365extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_GetGamepadInstanceGUID(SDL_JoystickID instance_id);
366
367/**
368 * Get the USB vendor ID of a gamepad, if available.
369 *
370 * This can be called before any gamepads are opened. If the vendor ID isn't
371 * available this function returns 0.
372 *
373 * \param instance_id the joystick instance ID
374 * \returns the USB vendor ID of the selected gamepad. If called on an invalid
375 * index, this function returns zero
376 *
377 * \since This function is available since SDL 3.0.0.
378 */
379extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadInstanceVendor(SDL_JoystickID instance_id);
380
381/**
382 * Get the USB product ID of a gamepad, if available.
383 *
384 * This can be called before any gamepads are opened. If the product ID isn't
385 * available this function returns 0.
386 *
387 * \param instance_id the joystick instance ID
388 * \returns the USB product ID of the selected gamepad. If called on an
389 * invalid index, this function returns zero
390 *
391 * \since This function is available since SDL 3.0.0.
392 */
393extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadInstanceProduct(SDL_JoystickID instance_id);
394
395/**
396 * Get the product version of a gamepad, if available.
397 *
398 * This can be called before any gamepads are opened. If the product version
399 * isn't available this function returns 0.
400 *
401 * \param instance_id the joystick instance ID
402 * \returns the product version of the selected gamepad. If called on an
403 * invalid index, this function returns zero
404 *
405 * \since This function is available since SDL 3.0.0.
406 */
407extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadInstanceProductVersion(SDL_JoystickID instance_id);
408
409/**
410 * Get the type of a gamepad.
411 *
412 * This can be called before any gamepads are opened.
413 *
414 * \param instance_id the joystick instance ID
415 * \returns the gamepad type.
416 *
417 * \since This function is available since SDL 3.0.0.
418 */
419extern DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadInstanceType(SDL_JoystickID instance_id);
420
421/**
422 * Get the mapping of a gamepad.
423 *
424 * This can be called before any gamepads are opened.
425 *
426 * \param instance_id the joystick instance ID
427 * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
428 * no mapping is available.
429 *
430 * \since This function is available since SDL 3.0.0.
431 */
432extern DECLSPEC char *SDLCALL SDL_GetGamepadInstanceMapping(SDL_JoystickID instance_id);
433
434/**
435 * Open a gamepad for use.
436 *
437 * \param instance_id the joystick instance ID
438 * \returns a gamepad identifier or NULL if an error occurred; call
439 * SDL_GetError() for more information.
440 *
441 * \since This function is available since SDL 3.0.0.
442 *
443 * \sa SDL_CloseGamepad
444 * \sa SDL_GetGamepadNameForIndex
445 * \sa SDL_IsGamepad
446 */
447extern DECLSPEC SDL_Gamepad *SDLCALL SDL_OpenGamepad(SDL_JoystickID instance_id);
448
449/**
450 * Get the SDL_Gamepad associated with a joystick instance ID, if it has been
451 * opened.
452 *
453 * \param instance_id the joystick instance ID of the gamepad
454 * \returns an SDL_Gamepad on success or NULL on failure or if it hasn't been
455 * opened yet; call SDL_GetError() for more information.
456 *
457 * \since This function is available since SDL 3.0.0.
458 */
459extern DECLSPEC SDL_Gamepad *SDLCALL SDL_GetGamepadFromInstanceID(SDL_JoystickID instance_id);
460
461/**
462 * Get the SDL_Gamepad associated with a player index.
463 *
464 * \param player_index the player index, which different from the instance ID
465 * \returns the SDL_Gamepad associated with a player index.
466 *
467 * \since This function is available since SDL 3.0.0.
468 *
469 * \sa SDL_GetGamepadPlayerIndex
470 * \sa SDL_SetGamepadPlayerIndex
471 */
472extern DECLSPEC SDL_Gamepad *SDLCALL SDL_GetGamepadFromPlayerIndex(int player_index);
473
474/**
475 * Get the implementation-dependent name for an opened gamepad.
476 *
477 * This is the same name as returned by SDL_GetGamepadNameForIndex(), but it
478 * takes a gamepad identifier instead of the (unstable) device index.
479 *
480 * \param gamepad a gamepad identifier previously returned by
481 * SDL_OpenGamepad()
482 * \returns the implementation dependent name for the gamepad, or NULL if
483 * there is no name or the identifier passed is invalid.
484 *
485 * \since This function is available since SDL 3.0.0.
486 *
487 * \sa SDL_GetGamepadNameForIndex
488 * \sa SDL_OpenGamepad
489 */
490extern DECLSPEC const char *SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad);
491
492/**
493 * Get the implementation-dependent path for an opened gamepad.
494 *
495 * This is the same path as returned by SDL_GetGamepadNameForIndex(), but it
496 * takes a gamepad identifier instead of the (unstable) device index.
497 *
498 * \param gamepad a gamepad identifier previously returned by
499 * SDL_OpenGamepad()
500 * \returns the implementation dependent path for the gamepad, or NULL if
501 * there is no path or the identifier passed is invalid.
502 *
503 * \since This function is available since SDL 3.0.0.
504 *
505 * \sa SDL_GetGamepadInstancePath
506 */
507extern DECLSPEC const char *SDLCALL SDL_GetGamepadPath(SDL_Gamepad *gamepad);
508
509/**
510 * Get the type of this currently opened gamepad
511 *
512 * This is the same name as returned by SDL_GetGamepadInstanceType(), but it
513 * takes a gamepad identifier instead of the (unstable) device index.
514 *
515 * \param gamepad the gamepad object to query.
516 * \returns the gamepad type.
517 *
518 * \since This function is available since SDL 3.0.0.
519 */
520extern DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadType(SDL_Gamepad *gamepad);
521
522/**
523 * Get the player index of an opened gamepad.
524 *
525 * For XInput gamepads this returns the XInput user index.
526 *
527 * \param gamepad the gamepad object to query.
528 * \returns the player index for gamepad, or -1 if it's not available.
529 *
530 * \since This function is available since SDL 3.0.0.
531 */
532extern DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad);
533
534/**
535 * Set the player index of an opened gamepad.
536 *
537 * \param gamepad the gamepad object to adjust.
538 * \param player_index Player index to assign to this gamepad, or -1 to clear
539 * the player index and turn off player LEDs.
540 *
541 * \since This function is available since SDL 3.0.0.
542 */
543extern DECLSPEC void SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
544
545/**
546 * Get the USB vendor ID of an opened gamepad, if available.
547 *
548 * If the vendor ID isn't available this function returns 0.
549 *
550 * \param gamepad the gamepad object to query.
551 * \return the USB vendor ID, or zero if unavailable.
552 *
553 * \since This function is available since SDL 3.0.0.
554 */
555extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadVendor(SDL_Gamepad *gamepad);
556
557/**
558 * Get the USB product ID of an opened gamepad, if available.
559 *
560 * If the product ID isn't available this function returns 0.
561 *
562 * \param gamepad the gamepad object to query.
563 * \return the USB product ID, or zero if unavailable.
564 *
565 * \since This function is available since SDL 3.0.0.
566 */
567extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadProduct(SDL_Gamepad *gamepad);
568
569/**
570 * Get the product version of an opened gamepad, if available.
571 *
572 * If the product version isn't available this function returns 0.
573 *
574 * \param gamepad the gamepad object to query.
575 * \return the USB product version, or zero if unavailable.
576 *
577 * \since This function is available since SDL 3.0.0.
578 */
579extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadProductVersion(SDL_Gamepad *gamepad);
580
581/**
582 * Get the firmware version of an opened gamepad, if available.
583 *
584 * If the firmware version isn't available this function returns 0.
585 *
586 * \param gamepad the gamepad object to query.
587 * \return the gamepad firmware version, or zero if unavailable.
588 *
589 * \since This function is available since SDL 3.0.0.
590 */
591extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadFirmwareVersion(SDL_Gamepad *gamepad);
592
593/**
594 * Get the serial number of an opened gamepad, if available.
595 *
596 * Returns the serial number of the gamepad, or NULL if it is not available.
597 *
598 * \param gamepad the gamepad object to query.
599 * \return the serial number, or NULL if unavailable.
600 *
601 * \since This function is available since SDL 3.0.0.
602 */
603extern DECLSPEC const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamepad);
604
605/**
606 * Check if a gamepad has been opened and is currently connected.
607 *
608 * \param gamepad a gamepad identifier previously returned by
609 * SDL_OpenGamepad()
610 * \returns SDL_TRUE if the gamepad has been opened and is currently
611 * connected, or SDL_FALSE if not.
612 *
613 * \since This function is available since SDL 3.0.0.
614 *
615 * \sa SDL_CloseGamepad
616 * \sa SDL_OpenGamepad
617 */
618extern DECLSPEC SDL_bool SDLCALL SDL_GamepadConnected(SDL_Gamepad *gamepad);
619
620/**
621 * Get the underlying joystick from a gamepad
622 *
623 * This function will give you a SDL_Joystick object, which allows you to use
624 * the SDL_Joystick functions with a SDL_Gamepad object. This would be useful
625 * for getting a joystick's position at any given time, even if it hasn't
626 * moved (moving it would produce an event, which would have the axis' value).
627 *
628 * The pointer returned is owned by the SDL_Gamepad. You should not call
629 * SDL_CloseJoystick() on it, for example, since doing so will likely cause
630 * SDL to crash.
631 *
632 * \param gamepad the gamepad object that you want to get a joystick from
633 * \returns an SDL_Joystick object; call SDL_GetError() for more information.
634 *
635 * \since This function is available since SDL 3.0.0.
636 */
637extern DECLSPEC SDL_Joystick *SDLCALL SDL_GetGamepadJoystick(SDL_Gamepad *gamepad);
638
639/**
640 * Set the state of gamepad event processing.
641 *
642 * If gamepad events are disabled, you must call SDL_UpdateGamepads() yourself
643 * and check the state of the gamepad when you want gamepad information.
644 *
645 * \param enabled whether to process gamepad events or not
646 *
647 * \since This function is available since SDL 3.0.0.
648 *
649 * \sa SDL_GamepadEventsEnabled
650 */
651extern DECLSPEC void SDLCALL SDL_SetGamepadEventsEnabled(SDL_bool enabled);
652
653/**
654 * Query the state of gamepad event processing.
655 *
656 * If gamepad events are disabled, you must call SDL_UpdateGamepads() yourself
657 * and check the state of the gamepad when you want gamepad information.
658 *
659 * \returns SDL_TRUE if gamepad events are being processed, SDL_FALSE
660 * otherwise.
661 *
662 * \since This function is available since SDL 3.0.0.
663 *
664 * \sa SDL_SetGamepadEventsEnabled
665 */
666extern DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void);
667
668/**
669 * Manually pump gamepad updates if not using the loop.
670 *
671 * This function is called automatically by the event loop if events are
672 * enabled. Under such circumstances, it will not be necessary to call this
673 * function.
674 *
675 * \since This function is available since SDL 3.0.0.
676 */
677extern DECLSPEC void SDLCALL SDL_UpdateGamepads(void);
678
679
680/**
681 * Convert a string into SDL_GamepadAxis enum.
682 *
683 * This function is called internally to translate SDL_Gamepad mapping strings
684 * for the underlying joystick device into the consistent SDL_Gamepad mapping.
685 * You do not normally need to call this function unless you are parsing
686 * SDL_Gamepad mappings in your own code.
687 *
688 * Note specially that "righttrigger" and "lefttrigger" map to
689 * `SDL_GAMEPAD_AXIS_RIGHT_TRIGGER` and `SDL_GAMEPAD_AXIS_LEFT_TRIGGER`,
690 * respectively.
691 *
692 * \param str string representing a SDL_Gamepad axis
693 * \returns the SDL_GamepadAxis enum corresponding to the input string, or
694 * `SDL_GAMEPAD_AXIS_INVALID` if no match was found.
695 *
696 * \since This function is available since SDL 3.0.0.
697 *
698 * \sa SDL_GetGamepadStringForAxis
699 */
700extern DECLSPEC SDL_GamepadAxis SDLCALL SDL_GetGamepadAxisFromString(const char *str);
701
702/**
703 * Convert from an SDL_GamepadAxis enum to a string.
704 *
705 * The caller should not SDL_free() the returned string.
706 *
707 * \param axis an enum value for a given SDL_GamepadAxis
708 * \returns a string for the given axis, or NULL if an invalid axis is
709 * specified. The string returned is of the format used by
710 * SDL_Gamepad mapping strings.
711 *
712 * \since This function is available since SDL 3.0.0.
713 *
714 * \sa SDL_GetGamepadAxisFromString
715 */
716extern DECLSPEC const char* SDLCALL SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis);
717
718/**
719 * Get the SDL joystick layer binding for a gamepad axis mapping.
720 *
721 * \param gamepad a gamepad
722 * \param axis an axis enum value (one of the SDL_GamepadAxis values)
723 * \returns a SDL_GamepadBinding describing the bind. On failure (like the
724 * given Controller axis doesn't exist on the device), its
725 * `.bindType` will be `SDL_GAMEPAD_BINDTYPE_NONE`.
726 *
727 * \since This function is available since SDL 3.0.0.
728 *
729 * \sa SDL_GetGamepadBindForButton
730 */
732
733/**
734 * Query whether a gamepad has a given axis.
735 *
736 * This merely reports whether the gamepad's mapping defined this axis, as
737 * that is all the information SDL has about the physical device.
738 *
739 * \param gamepad a gamepad
740 * \param axis an axis enum value (an SDL_GamepadAxis value)
741 * \returns SDL_TRUE if the gamepad has this axis, SDL_FALSE otherwise.
742 *
743 * \since This function is available since SDL 3.0.0.
744 */
745extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis);
746
747/**
748 * Get the current state of an axis control on a gamepad.
749 *
750 * The axis indices start at index 0.
751 *
752 * The state is a value ranging from -32768 to 32767. Triggers, however, range
753 * from 0 to 32767 (they never return a negative value).
754 *
755 * \param gamepad a gamepad
756 * \param axis an axis index (one of the SDL_GamepadAxis values)
757 * \returns axis state (including 0) on success or 0 (also) on failure; call
758 * SDL_GetError() for more information.
759 *
760 * \since This function is available since SDL 3.0.0.
761 *
762 * \sa SDL_GetGamepadButton
763 */
764extern DECLSPEC Sint16 SDLCALL SDL_GetGamepadAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis);
765
766/**
767 * Convert a string into an SDL_GamepadButton enum.
768 *
769 * This function is called internally to translate SDL_Gamepad mapping strings
770 * for the underlying joystick device into the consistent SDL_Gamepad mapping.
771 * You do not normally need to call this function unless you are parsing
772 * SDL_Gamepad mappings in your own code.
773 *
774 * \param str string representing a SDL_Gamepad axis
775 * \returns the SDL_GamepadButton enum corresponding to the input string, or
776 * `SDL_GAMEPAD_AXIS_INVALID` if no match was found.
777 *
778 * \since This function is available since SDL 3.0.0.
779 */
780extern DECLSPEC SDL_GamepadButton SDLCALL SDL_GetGamepadButtonFromString(const char *str);
781
782/**
783 * Convert from an SDL_GamepadButton enum to a string.
784 *
785 * The caller should not SDL_free() the returned string.
786 *
787 * \param button an enum value for a given SDL_GamepadButton
788 * \returns a string for the given button, or NULL if an invalid button is
789 * specified. The string returned is of the format used by
790 * SDL_Gamepad mapping strings.
791 *
792 * \since This function is available since SDL 3.0.0.
793 *
794 * \sa SDL_GetGamepadButtonFromString
795 */
796extern DECLSPEC const char* SDLCALL SDL_GetGamepadStringForButton(SDL_GamepadButton button);
797
798/**
799 * Get the SDL joystick layer binding for a gamepad button mapping.
800 *
801 * \param gamepad a gamepad
802 * \param button an button enum value (an SDL_GamepadButton value)
803 * \returns a SDL_GamepadBinding describing the bind. On failure (like the
804 * given Controller button doesn't exist on the device), its
805 * `.bindType` will be `SDL_GAMEPAD_BINDTYPE_NONE`.
806 *
807 * \since This function is available since SDL 3.0.0.
808 *
809 * \sa SDL_GetGamepadBindForAxis
810 */
812
813/**
814 * Query whether a gamepad has a given button.
815 *
816 * This merely reports whether the gamepad's mapping defined this button, as
817 * that is all the information SDL has about the physical device.
818 *
819 * \param gamepad a gamepad
820 * \param button a button enum value (an SDL_GamepadButton value)
821 * \returns SDL_TRUE if the gamepad has this button, SDL_FALSE otherwise.
822 *
823 * \since This function is available since SDL 3.0.0.
824 */
825extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);
826
827/**
828 * Get the current state of a button on a gamepad.
829 *
830 * \param gamepad a gamepad
831 * \param button a button index (one of the SDL_GamepadButton values)
832 * \returns 1 for pressed state or 0 for not pressed state or error; call
833 * SDL_GetError() for more information.
834 *
835 * \since This function is available since SDL 3.0.0.
836 *
837 * \sa SDL_GetGamepadAxis
838 */
839extern DECLSPEC Uint8 SDLCALL SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);
840
841/**
842 * Get the number of touchpads on a gamepad.
843 *
844 * \since This function is available since SDL 3.0.0.
845 */
846extern DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpads(SDL_Gamepad *gamepad);
847
848/**
849 * Get the number of supported simultaneous fingers on a touchpad on a game
850 * gamepad.
851 *
852 * \since This function is available since SDL 3.0.0.
853 */
854extern DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpadFingers(SDL_Gamepad *gamepad, int touchpad);
855
856/**
857 * Get the current state of a finger on a touchpad on a gamepad.
858 *
859 * \since This function is available since SDL 3.0.0.
860 */
861extern DECLSPEC int SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
862
863/**
864 * Return whether a gamepad has a particular sensor.
865 *
866 * \param gamepad The gamepad to query
867 * \param type The type of sensor to query
868 * \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise.
869 *
870 * \since This function is available since SDL 3.0.0.
871 */
873
874/**
875 * Set whether data reporting for a gamepad sensor is enabled.
876 *
877 * \param gamepad The gamepad to update
878 * \param type The type of sensor to enable/disable
879 * \param enabled Whether data reporting should be enabled
880 * \returns 0 or -1 if an error occurred.
881 *
882 * \since This function is available since SDL 3.0.0.
883 */
885
886/**
887 * Query whether sensor data reporting is enabled for a gamepad.
888 *
889 * \param gamepad The gamepad to query
890 * \param type The type of sensor to query
891 * \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise.
892 *
893 * \since This function is available since SDL 3.0.0.
894 */
896
897/**
898 * Get the data rate (number of events per second) of a gamepad sensor.
899 *
900 * \param gamepad The gamepad to query
901 * \param type The type of sensor to query
902 * \return the data rate, or 0.0f if the data rate is not available.
903 *
904 * \since This function is available since SDL 3.0.0.
905 */
906extern DECLSPEC float SDLCALL SDL_GetGamepadSensorDataRate(SDL_Gamepad *gamepad, SDL_SensorType type);
907
908/**
909 * Get the current state of a gamepad sensor.
910 *
911 * The number of values and interpretation of the data is sensor dependent.
912 * See SDL_sensor.h for the details for each type of sensor.
913 *
914 * \param gamepad The gamepad to query
915 * \param type The type of sensor to query
916 * \param data A pointer filled with the current sensor state
917 * \param num_values The number of values to write to data
918 * \return 0 or -1 if an error occurred.
919 *
920 * \since This function is available since SDL 3.0.0.
921 */
922extern DECLSPEC int SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values);
923
924/**
925 * Start a rumble effect on a gamepad.
926 *
927 * Each call to this function cancels any previous rumble effect, and calling
928 * it with 0 intensity stops any rumbling.
929 *
930 * \param gamepad The gamepad to vibrate
931 * \param low_frequency_rumble The intensity of the low frequency (left)
932 * rumble motor, from 0 to 0xFFFF
933 * \param high_frequency_rumble The intensity of the high frequency (right)
934 * rumble motor, from 0 to 0xFFFF
935 * \param duration_ms The duration of the rumble effect, in milliseconds
936 * \returns 0, or -1 if rumble isn't supported on this gamepad
937 *
938 * \since This function is available since SDL 3.0.0.
939 *
940 * \sa SDL_GamepadHasRumble
941 */
942extern DECLSPEC int SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
943
944/**
945 * Start a rumble effect in the gamepad's triggers.
946 *
947 * Each call to this function cancels any previous trigger rumble effect, and
948 * calling it with 0 intensity stops any rumbling.
949 *
950 * Note that this is rumbling of the _triggers_ and not the gamepad as a
951 * whole. This is currently only supported on Xbox One gamepads. If you want
952 * the (more common) whole-gamepad rumble, use SDL_RumbleGamepad() instead.
953 *
954 * \param gamepad The gamepad to vibrate
955 * \param left_rumble The intensity of the left trigger rumble motor, from 0
956 * to 0xFFFF
957 * \param right_rumble The intensity of the right trigger rumble motor, from 0
958 * to 0xFFFF
959 * \param duration_ms The duration of the rumble effect, in milliseconds
960 * \returns 0, or -1 if trigger rumble isn't supported on this gamepad
961 *
962 * \since This function is available since SDL 3.0.0.
963 *
964 * \sa SDL_GamepadHasRumbleTriggers
965 */
966extern DECLSPEC int SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
967
968/**
969 * Query whether a gamepad has an LED.
970 *
971 * \param gamepad The gamepad to query
972 * \returns SDL_TRUE, or SDL_FALSE if this gamepad does not have a modifiable
973 * LED
974 *
975 * \since This function is available since SDL 3.0.0.
976 */
977extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasLED(SDL_Gamepad *gamepad);
978
979/**
980 * Query whether a gamepad has rumble support.
981 *
982 * \param gamepad The gamepad to query
983 * \returns SDL_TRUE, or SDL_FALSE if this gamepad does not have rumble
984 * support
985 *
986 * \since This function is available since SDL 3.0.0.
987 *
988 * \sa SDL_RumbleGamepad
989 */
990extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasRumble(SDL_Gamepad *gamepad);
991
992/**
993 * Query whether a gamepad has rumble support on triggers.
994 *
995 * \param gamepad The gamepad to query
996 * \returns SDL_TRUE, or SDL_FALSE if this gamepad does not have trigger
997 * rumble support
998 *
999 * \since This function is available since SDL 3.0.0.
1000 *
1001 * \sa SDL_RumbleGamepadTriggers
1002 */
1003extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasRumbleTriggers(SDL_Gamepad *gamepad);
1004
1005/**
1006 * Update a gamepad's LED color.
1007 *
1008 * \param gamepad The gamepad to update
1009 * \param red The intensity of the red LED
1010 * \param green The intensity of the green LED
1011 * \param blue The intensity of the blue LED
1012 * \returns 0, or -1 if this gamepad does not have a modifiable LED
1013 *
1014 * \since This function is available since SDL 3.0.0.
1015 */
1016extern DECLSPEC int SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue);
1017
1018/**
1019 * Send a gamepad specific effect packet
1020 *
1021 * \param gamepad The gamepad to affect
1022 * \param data The data to send to the gamepad
1023 * \param size The size of the data to send to the gamepad
1024 * \returns 0, or -1 if this gamepad or driver doesn't support effect packets
1025 *
1026 * \since This function is available since SDL 3.0.0.
1027 */
1028extern DECLSPEC int SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size);
1029
1030/**
1031 * Close a gamepad previously opened with SDL_OpenGamepad().
1032 *
1033 * \param gamepad a gamepad identifier previously returned by
1034 * SDL_OpenGamepad()
1035 *
1036 * \since This function is available since SDL 3.0.0.
1037 *
1038 * \sa SDL_OpenGamepad
1039 */
1040extern DECLSPEC void SDLCALL SDL_CloseGamepad(SDL_Gamepad *gamepad);
1041
1042/**
1043 * Return the sfSymbolsName for a given button on a gamepad on Apple
1044 * platforms.
1045 *
1046 * \param gamepad the gamepad to query
1047 * \param button a button on the gamepad
1048 * \returns the sfSymbolsName or NULL if the name can't be found
1049 *
1050 * \since This function is available since SDL 3.0.0.
1051 *
1052 * \sa SDL_GetGamepadAppleSFSymbolsNameForAxis
1053 */
1054extern DECLSPEC const char* SDLCALL SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);
1055
1056/**
1057 * Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
1058 *
1059 * \param gamepad the gamepad to query
1060 * \param axis an axis on the gamepad
1061 * \returns the sfSymbolsName or NULL if the name can't be found
1062 *
1063 * \since This function is available since SDL 3.0.0.
1064 *
1065 * \sa SDL_GetGamepadAppleSFSymbolsNameForButton
1066 */
1067extern DECLSPEC const char* SDLCALL SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis);
1068
1069
1070/* Ends C function definitions when using C++ */
1071#ifdef __cplusplus
1072}
1073#endif
1074#include <SDL3/SDL_close_code.h>
1075
1076#endif /* SDL_gamepad_h_ */
SDL_Gamepad * SDL_OpenGamepad(SDL_JoystickID instance_id)
SDL_bool SDL_GamepadHasAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
int SDL_GetNumGamepadMappings(void)
const char * SDL_GetGamepadInstancePath(SDL_JoystickID instance_id)
int SDL_GetNumGamepadTouchpads(SDL_Gamepad *gamepad)
SDL_GamepadAxis
Definition: SDL_gamepad.h:119
@ SDL_GAMEPAD_AXIS_RIGHTX
Definition: SDL_gamepad.h:123
@ SDL_GAMEPAD_AXIS_MAX
Definition: SDL_gamepad.h:127
@ SDL_GAMEPAD_AXIS_RIGHT_TRIGGER
Definition: SDL_gamepad.h:126
@ SDL_GAMEPAD_AXIS_LEFTX
Definition: SDL_gamepad.h:121
@ SDL_GAMEPAD_AXIS_INVALID
Definition: SDL_gamepad.h:120
@ SDL_GAMEPAD_AXIS_LEFTY
Definition: SDL_gamepad.h:122
@ SDL_GAMEPAD_AXIS_LEFT_TRIGGER
Definition: SDL_gamepad.h:125
@ SDL_GAMEPAD_AXIS_RIGHTY
Definition: SDL_gamepad.h:124
int SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure)
Uint8 SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
SDL_GamepadType SDL_GetGamepadType(SDL_Gamepad *gamepad)
int SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values)
SDL_GamepadBinding SDL_GetGamepadBindForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
SDL_GamepadAxis SDL_GetGamepadAxisFromString(const char *str)
void SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index)
SDL_GamepadButton SDL_GetGamepadButtonFromString(const char *str)
struct SDL_Gamepad SDL_Gamepad
Definition: SDL_gamepad.h:59
SDL_bool SDL_GamepadHasButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
SDL_GamepadBindingType
Definition: SDL_gamepad.h:131
@ SDL_GAMEPAD_BINDTYPE_HAT
Definition: SDL_gamepad.h:135
@ SDL_GAMEPAD_BINDTYPE_BUTTON
Definition: SDL_gamepad.h:133
@ SDL_GAMEPAD_BINDTYPE_NONE
Definition: SDL_gamepad.h:132
@ SDL_GAMEPAD_BINDTYPE_AXIS
Definition: SDL_gamepad.h:134
Uint16 SDL_GetGamepadFirmwareVersion(SDL_Gamepad *gamepad)
SDL_GamepadButton
Definition: SDL_gamepad.h:83
@ SDL_GAMEPAD_BUTTON_PADDLE4
Definition: SDL_gamepad.h:104
@ SDL_GAMEPAD_BUTTON_PADDLE2
Definition: SDL_gamepad.h:102
@ SDL_GAMEPAD_BUTTON_GUIDE
Definition: SDL_gamepad.h:90
@ SDL_GAMEPAD_BUTTON_LEFT_STICK
Definition: SDL_gamepad.h:92
@ SDL_GAMEPAD_BUTTON_TOUCHPAD
Definition: SDL_gamepad.h:105
@ SDL_GAMEPAD_BUTTON_PADDLE1
Definition: SDL_gamepad.h:101
@ SDL_GAMEPAD_BUTTON_LEFT_SHOULDER
Definition: SDL_gamepad.h:94
@ SDL_GAMEPAD_BUTTON_DPAD_DOWN
Definition: SDL_gamepad.h:97
@ SDL_GAMEPAD_BUTTON_MAX
Definition: SDL_gamepad.h:106
@ SDL_GAMEPAD_BUTTON_INVALID
Definition: SDL_gamepad.h:84
@ SDL_GAMEPAD_BUTTON_MISC1
Definition: SDL_gamepad.h:100
@ SDL_GAMEPAD_BUTTON_B
Definition: SDL_gamepad.h:86
@ SDL_GAMEPAD_BUTTON_A
Definition: SDL_gamepad.h:85
@ SDL_GAMEPAD_BUTTON_PADDLE3
Definition: SDL_gamepad.h:103
@ SDL_GAMEPAD_BUTTON_BACK
Definition: SDL_gamepad.h:89
@ SDL_GAMEPAD_BUTTON_DPAD_UP
Definition: SDL_gamepad.h:96
@ SDL_GAMEPAD_BUTTON_RIGHT_STICK
Definition: SDL_gamepad.h:93
@ SDL_GAMEPAD_BUTTON_START
Definition: SDL_gamepad.h:91
@ SDL_GAMEPAD_BUTTON_DPAD_RIGHT
Definition: SDL_gamepad.h:99
@ SDL_GAMEPAD_BUTTON_Y
Definition: SDL_gamepad.h:88
@ SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER
Definition: SDL_gamepad.h:95
@ SDL_GAMEPAD_BUTTON_X
Definition: SDL_gamepad.h:87
@ SDL_GAMEPAD_BUTTON_DPAD_LEFT
Definition: SDL_gamepad.h:98
SDL_bool SDL_GamepadHasRumbleTriggers(SDL_Gamepad *gamepad)
SDL_Gamepad * SDL_GetGamepadFromInstanceID(SDL_JoystickID instance_id)
int SDL_AddGamepadMapping(const char *mappingString)
char * SDL_GetGamepadMapping(SDL_Gamepad *gamepad)
Uint16 SDL_GetGamepadProductVersion(SDL_Gamepad *gamepad)
char * SDL_GetGamepadInstanceMapping(SDL_JoystickID instance_id)
SDL_bool SDL_GamepadHasLED(SDL_Gamepad *gamepad)
Uint16 SDL_GetGamepadProduct(SDL_Gamepad *gamepad)
int SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size)
char * SDL_GetGamepadMappingForGUID(SDL_JoystickGUID guid)
int SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, SDL_bool enabled)
int SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad)
const char * SDL_GetGamepadName(SDL_Gamepad *gamepad)
const char * SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
char * SDL_GetGamepadMappingForIndex(int mapping_index)
int SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms)
SDL_bool SDL_GamepadConnected(SDL_Gamepad *gamepad)
int SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
const char * SDL_GetGamepadSerial(SDL_Gamepad *gamepad)
const char * SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis)
int SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue)
const char * SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
const char * SDL_GetGamepadStringForButton(SDL_GamepadButton button)
Uint16 SDL_GetGamepadInstanceProduct(SDL_JoystickID instance_id)
int SDL_AddGamepadMappingsFromRW(SDL_RWops *rw, int freerw)
void SDL_SetGamepadEventsEnabled(SDL_bool enabled)
SDL_Joystick * SDL_GetGamepadJoystick(SDL_Gamepad *gamepad)
Uint16 SDL_GetGamepadInstanceProductVersion(SDL_JoystickID instance_id)
SDL_bool SDL_IsGamepad(SDL_JoystickID instance_id)
SDL_Gamepad * SDL_GetGamepadFromPlayerIndex(int player_index)
SDL_GamepadBinding SDL_GetGamepadBindForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
SDL_bool SDL_GamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type)
const char * SDL_GetGamepadInstanceName(SDL_JoystickID instance_id)
Sint16 SDL_GetGamepadAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
void SDL_UpdateGamepads(void)
void SDL_CloseGamepad(SDL_Gamepad *gamepad)
SDL_GamepadType
Definition: SDL_gamepad.h:62
@ SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT
Definition: SDL_gamepad.h:71
@ SDL_GAMEPAD_TYPE_PS5
Definition: SDL_gamepad.h:69
@ SDL_GAMEPAD_TYPE_VIRTUAL
Definition: SDL_gamepad.h:64
@ SDL_GAMEPAD_TYPE_UNKNOWN
Definition: SDL_gamepad.h:63
@ SDL_GAMEPAD_TYPE_XBOX360
Definition: SDL_gamepad.h:65
@ SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT
Definition: SDL_gamepad.h:72
@ SDL_GAMEPAD_TYPE_NVIDIA_SHIELD
Definition: SDL_gamepad.h:76
@ SDL_GAMEPAD_TYPE_XBOXONE
Definition: SDL_gamepad.h:66
@ SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO
Definition: SDL_gamepad.h:70
@ SDL_GAMEPAD_TYPE_PS4
Definition: SDL_gamepad.h:68
@ SDL_GAMEPAD_TYPE_AMAZON_LUNA
Definition: SDL_gamepad.h:74
@ SDL_GAMEPAD_TYPE_PS3
Definition: SDL_gamepad.h:67
@ SDL_GAMEPAD_TYPE_GOOGLE_STADIA
Definition: SDL_gamepad.h:75
@ SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR
Definition: SDL_gamepad.h:73
SDL_JoystickGUID SDL_GetGamepadInstanceGUID(SDL_JoystickID instance_id)
Uint16 SDL_GetGamepadInstanceVendor(SDL_JoystickID instance_id)
SDL_bool SDL_GamepadHasSensor(SDL_Gamepad *gamepad, SDL_SensorType type)
int SDL_GetGamepadInstancePlayerIndex(SDL_JoystickID instance_id)
SDL_GamepadType SDL_GetGamepadInstanceType(SDL_JoystickID instance_id)
SDL_bool SDL_GamepadEventsEnabled(void)
SDL_bool SDL_GamepadHasRumble(SDL_Gamepad *gamepad)
Uint16 SDL_GetGamepadVendor(SDL_Gamepad *gamepad)
int SDL_GetNumGamepadTouchpadFingers(SDL_Gamepad *gamepad, int touchpad)
const char * SDL_GetGamepadPath(SDL_Gamepad *gamepad)
float SDL_GetGamepadSensorDataRate(SDL_Gamepad *gamepad, SDL_SensorType type)
SDL_JoystickID * SDL_GetGamepads(int *count)
Uint32 SDL_JoystickID
Definition: SDL_joystick.h:83
struct SDL_Joystick SDL_Joystick
Definition: SDL_joystick.h:71
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
GLuint GLuint GLsizei count
Definition: SDL_opengl.h:1564
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1967
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1564
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLbyte GLbyte blue
GLsizeiptr size
GLbyte green
SDL_SensorType
Definition: SDL_sensor.h:70
uint8_t Uint8
Definition: SDL_stdinc.h:147
uint16_t Uint16
Definition: SDL_stdinc.h:159
SDL_bool
Definition: SDL_stdinc.h:130
int16_t Sint16
Definition: SDL_stdinc.h:153
uint32_t Uint32
Definition: SDL_stdinc.h:171
union SDL_GamepadBinding::@0 value
SDL_GamepadBindingType bindType
Definition: SDL_gamepad.h:143