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 * \param mapping_index mapping index
236 * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
237 * the index is out of range.
238 *
239 * \since This function is available since SDL 3.0.0.
240 */
241extern DECLSPEC char * SDLCALL SDL_GetGamepadMappingForIndex(int mapping_index);
242
243/**
244 * Get the gamepad mapping string for a given GUID.
245 *
246 * The returned string must be freed with SDL_free().
247 *
248 * \param guid a structure containing the GUID for which a mapping is desired
249 * \returns a mapping string or NULL on error; call SDL_GetError() for more
250 * information.
251 *
252 * \since This function is available since SDL 3.0.0.
253 *
254 * \sa SDL_GetJoystickInstanceGUID
255 * \sa SDL_GetJoystickGUID
256 */
257extern DECLSPEC char * SDLCALL SDL_GetGamepadMappingForGUID(SDL_JoystickGUID guid);
258
259/**
260 * Get the current mapping of a gamepad.
261 *
262 * The returned string must be freed with SDL_free().
263 *
264 * Details about mappings are discussed with SDL_AddGamepadMapping().
265 *
266 * \param gamepad the gamepad you want to get the current mapping for
267 * \returns a string that has the gamepad's mapping or NULL if no mapping is
268 * available; call SDL_GetError() for more information.
269 *
270 * \since This function is available since SDL 3.0.0.
271 *
272 * \sa SDL_AddGamepadMapping
273 * \sa SDL_GetGamepadMappingForGUID
274 */
275extern DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad);
276
277/**
278 * Get a list of currently connected gamepads.
279 *
280 * \param count a pointer filled in with the number of gamepads returned
281 * \returns a 0 terminated array of joystick instance IDs which should be
282 * freed with SDL_free(), or NULL on error; call SDL_GetError() for
283 * more details.
284 *
285 * \since This function is available since SDL 3.0.0.
286 *
287 * \sa SDL_OpenGamepad
288 */
289extern DECLSPEC SDL_JoystickID *SDLCALL SDL_GetGamepads(int *count);
290
291/**
292 * Check if the given joystick is supported by the gamepad interface.
293 *
294 * \param instance_id the joystick instance ID
295 * \returns SDL_TRUE if the given joystick is supported by the gamepad
296 * interface, SDL_FALSE if it isn't or it's an invalid index.
297 *
298 * \since This function is available since SDL 3.0.0.
299 *
300 * \sa SDL_GetGamepadNameForIndex
301 * \sa SDL_OpenGamepad
302 */
303extern DECLSPEC SDL_bool SDLCALL SDL_IsGamepad(SDL_JoystickID instance_id);
304
305/**
306 * Get the implementation dependent name of a gamepad.
307 *
308 * This can be called before any gamepads are opened.
309 *
310 * \param instance_id the joystick instance ID
311 * \returns the name of the selected gamepad. If no name can be found, this
312 * function returns NULL; call SDL_GetError() for more information.
313 *
314 * \since This function is available since SDL 3.0.0.
315 *
316 * \sa SDL_GetGamepadName
317 * \sa SDL_OpenGamepad
318 */
319extern DECLSPEC const char *SDLCALL SDL_GetGamepadInstanceName(SDL_JoystickID instance_id);
320
321/**
322 * Get the implementation dependent path of a gamepad.
323 *
324 * This can be called before any gamepads are opened.
325 *
326 * \param instance_id the joystick instance ID
327 * \returns the path of the selected gamepad. If no path can be found, this
328 * function returns NULL; call SDL_GetError() for more information.
329 *
330 * \since This function is available since SDL 3.0.0.
331 *
332 * \sa SDL_GetGamepadPath
333 * \sa SDL_OpenGamepad
334 */
335extern DECLSPEC const char *SDLCALL SDL_GetGamepadInstancePath(SDL_JoystickID instance_id);
336
337/**
338 * Get the player index of a gamepad.
339 *
340 * This can be called before any gamepads are opened.
341 *
342 * \param instance_id the joystick instance ID
343 * \returns the player index of a gamepad, or -1 if it's not available
344 *
345 * \since This function is available since SDL 3.0.0.
346 *
347 * \sa SDL_GetGamepadPlayerIndex
348 * \sa SDL_OpenGamepad
349 */
350extern DECLSPEC int SDLCALL SDL_GetGamepadInstancePlayerIndex(SDL_JoystickID instance_id);
351
352/**
353 * Get the implementation-dependent GUID of a gamepad.
354 *
355 * This can be called before any gamepads are opened.
356 *
357 * \param instance_id the joystick instance ID
358 * \returns the GUID of the selected gamepad. If called on an invalid index,
359 * this function returns a zero GUID
360 *
361 * \since This function is available since SDL 3.0.0.
362 *
363 * \sa SDL_GetGamepadGUID
364 * \sa SDL_GetGamepadGUIDString
365 */
366extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_GetGamepadInstanceGUID(SDL_JoystickID instance_id);
367
368/**
369 * Get the USB vendor ID of a gamepad, if available.
370 *
371 * This can be called before any gamepads are opened. If the vendor ID isn't
372 * available this function returns 0.
373 *
374 * \param instance_id the joystick instance ID
375 * \returns the USB vendor ID of the selected gamepad. If called on an invalid
376 * index, this function returns zero
377 *
378 * \since This function is available since SDL 3.0.0.
379 */
380extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadInstanceVendor(SDL_JoystickID instance_id);
381
382/**
383 * Get the USB product ID of a gamepad, if available.
384 *
385 * This can be called before any gamepads are opened. If the product ID isn't
386 * available this function returns 0.
387 *
388 * \param instance_id the joystick instance ID
389 * \returns the USB product ID of the selected gamepad. If called on an
390 * invalid index, this function returns zero
391 *
392 * \since This function is available since SDL 3.0.0.
393 */
394extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadInstanceProduct(SDL_JoystickID instance_id);
395
396/**
397 * Get the product version of a gamepad, if available.
398 *
399 * This can be called before any gamepads are opened. If the product version
400 * isn't available this function returns 0.
401 *
402 * \param instance_id the joystick instance ID
403 * \returns the product version of the selected gamepad. If called on an
404 * invalid index, this function returns zero
405 *
406 * \since This function is available since SDL 3.0.0.
407 */
408extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadInstanceProductVersion(SDL_JoystickID instance_id);
409
410/**
411 * Get the type of a gamepad.
412 *
413 * This can be called before any gamepads are opened.
414 *
415 * \param instance_id the joystick instance ID
416 * \returns the gamepad type.
417 *
418 * \since This function is available since SDL 3.0.0.
419 */
420extern DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadInstanceType(SDL_JoystickID instance_id);
421
422/**
423 * Get the mapping of a gamepad.
424 *
425 * This can be called before any gamepads are opened.
426 *
427 * \param instance_id the joystick instance ID
428 * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
429 * no mapping is available.
430 *
431 * \since This function is available since SDL 3.0.0.
432 */
433extern DECLSPEC char *SDLCALL SDL_GetGamepadInstanceMapping(SDL_JoystickID instance_id);
434
435/**
436 * Open a gamepad for use.
437 *
438 * \param instance_id the joystick instance ID
439 * \returns a gamepad identifier or NULL if an error occurred; call
440 * SDL_GetError() for more information.
441 *
442 * \since This function is available since SDL 3.0.0.
443 *
444 * \sa SDL_CloseGamepad
445 * \sa SDL_GetGamepadNameForIndex
446 * \sa SDL_IsGamepad
447 */
448extern DECLSPEC SDL_Gamepad *SDLCALL SDL_OpenGamepad(SDL_JoystickID instance_id);
449
450/**
451 * Get the SDL_Gamepad associated with a joystick instance ID, if it has been
452 * opened.
453 *
454 * \param instance_id the joystick instance ID of the gamepad
455 * \returns an SDL_Gamepad on success or NULL on failure or if it hasn't been
456 * opened yet; call SDL_GetError() for more information.
457 *
458 * \since This function is available since SDL 3.0.0.
459 */
460extern DECLSPEC SDL_Gamepad *SDLCALL SDL_GetGamepadFromInstanceID(SDL_JoystickID instance_id);
461
462/**
463 * Get the SDL_Gamepad associated with a player index.
464 *
465 * \param player_index the player index, which different from the instance ID
466 * \returns the SDL_Gamepad associated with a player index.
467 *
468 * \since This function is available since SDL 3.0.0.
469 *
470 * \sa SDL_GetGamepadPlayerIndex
471 * \sa SDL_SetGamepadPlayerIndex
472 */
473extern DECLSPEC SDL_Gamepad *SDLCALL SDL_GetGamepadFromPlayerIndex(int player_index);
474
475/**
476 * Get the implementation-dependent name for an opened gamepad.
477 *
478 * This is the same name as returned by SDL_GetGamepadNameForIndex(), but it
479 * takes a gamepad identifier instead of the (unstable) device index.
480 *
481 * \param gamepad a gamepad identifier previously returned by
482 * SDL_OpenGamepad()
483 * \returns the implementation dependent name for the gamepad, or NULL if
484 * there is no name or the identifier passed is invalid.
485 *
486 * \since This function is available since SDL 3.0.0.
487 *
488 * \sa SDL_GetGamepadNameForIndex
489 * \sa SDL_OpenGamepad
490 */
491extern DECLSPEC const char *SDLCALL SDL_GetGamepadName(SDL_Gamepad *gamepad);
492
493/**
494 * Get the implementation-dependent path for an opened gamepad.
495 *
496 * This is the same path as returned by SDL_GetGamepadNameForIndex(), but it
497 * takes a gamepad identifier instead of the (unstable) device index.
498 *
499 * \param gamepad a gamepad identifier previously returned by
500 * SDL_OpenGamepad()
501 * \returns the implementation dependent path for the gamepad, or NULL if
502 * there is no path or the identifier passed is invalid.
503 *
504 * \since This function is available since SDL 3.0.0.
505 *
506 * \sa SDL_GetGamepadInstancePath
507 */
508extern DECLSPEC const char *SDLCALL SDL_GetGamepadPath(SDL_Gamepad *gamepad);
509
510/**
511 * Get the type of this currently opened gamepad
512 *
513 * This is the same name as returned by SDL_GetGamepadInstanceType(), but it
514 * takes a gamepad identifier instead of the (unstable) device index.
515 *
516 * \param gamepad the gamepad object to query.
517 * \returns the gamepad type.
518 *
519 * \since This function is available since SDL 3.0.0.
520 */
521extern DECLSPEC SDL_GamepadType SDLCALL SDL_GetGamepadType(SDL_Gamepad *gamepad);
522
523/**
524 * Get the player index of an opened gamepad.
525 *
526 * For XInput gamepads this returns the XInput user index.
527 *
528 * \param gamepad the gamepad object to query.
529 * \returns the player index for gamepad, or -1 if it's not available.
530 *
531 * \since This function is available since SDL 3.0.0.
532 */
533extern DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad);
534
535/**
536 * Set the player index of an opened gamepad.
537 *
538 * \param gamepad the gamepad object to adjust.
539 * \param player_index Player index to assign to this gamepad, or -1 to clear
540 * the player index and turn off player LEDs.
541 * \returns 0 on success or a negative error code on failure; call
542 * SDL_GetError() for more information.
543 *
544 * \since This function is available since SDL 3.0.0.
545 */
546extern DECLSPEC int SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index);
547
548/**
549 * Get the USB vendor ID of an opened gamepad, if available.
550 *
551 * If the vendor ID isn't available this function returns 0.
552 *
553 * \param gamepad the gamepad object to query.
554 * \returns the USB vendor ID, or zero if unavailable.
555 *
556 * \since This function is available since SDL 3.0.0.
557 */
558extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadVendor(SDL_Gamepad *gamepad);
559
560/**
561 * Get the USB product ID of an opened gamepad, if available.
562 *
563 * If the product ID isn't available this function returns 0.
564 *
565 * \param gamepad the gamepad object to query.
566 * \returns the USB product ID, or zero if unavailable.
567 *
568 * \since This function is available since SDL 3.0.0.
569 */
570extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadProduct(SDL_Gamepad *gamepad);
571
572/**
573 * Get the product version of an opened gamepad, if available.
574 *
575 * If the product version isn't available this function returns 0.
576 *
577 * \param gamepad the gamepad object to query.
578 * \returns the USB product version, or zero if unavailable.
579 *
580 * \since This function is available since SDL 3.0.0.
581 */
582extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadProductVersion(SDL_Gamepad *gamepad);
583
584/**
585 * Get the firmware version of an opened gamepad, if available.
586 *
587 * If the firmware version isn't available this function returns 0.
588 *
589 * \param gamepad the gamepad object to query.
590 * \returns the gamepad firmware version, or zero if unavailable.
591 *
592 * \since This function is available since SDL 3.0.0.
593 */
594extern DECLSPEC Uint16 SDLCALL SDL_GetGamepadFirmwareVersion(SDL_Gamepad *gamepad);
595
596/**
597 * Get the serial number of an opened gamepad, if available.
598 *
599 * Returns the serial number of the gamepad, or NULL if it is not available.
600 *
601 * \param gamepad the gamepad object to query.
602 * \returns the serial number, or NULL if unavailable.
603 *
604 * \since This function is available since SDL 3.0.0.
605 */
606extern DECLSPEC const char * SDLCALL SDL_GetGamepadSerial(SDL_Gamepad *gamepad);
607
608/**
609 * Check if a gamepad has been opened and is currently connected.
610 *
611 * \param gamepad a gamepad identifier previously returned by
612 * SDL_OpenGamepad()
613 * \returns SDL_TRUE if the gamepad has been opened and is currently
614 * connected, or SDL_FALSE if not.
615 *
616 * \since This function is available since SDL 3.0.0.
617 *
618 * \sa SDL_CloseGamepad
619 * \sa SDL_OpenGamepad
620 */
621extern DECLSPEC SDL_bool SDLCALL SDL_GamepadConnected(SDL_Gamepad *gamepad);
622
623/**
624 * Get the underlying joystick from a gamepad
625 *
626 * This function will give you a SDL_Joystick object, which allows you to use
627 * the SDL_Joystick functions with a SDL_Gamepad object. This would be useful
628 * for getting a joystick's position at any given time, even if it hasn't
629 * moved (moving it would produce an event, which would have the axis' value).
630 *
631 * The pointer returned is owned by the SDL_Gamepad. You should not call
632 * SDL_CloseJoystick() on it, for example, since doing so will likely cause
633 * SDL to crash.
634 *
635 * \param gamepad the gamepad object that you want to get a joystick from
636 * \returns an SDL_Joystick object; call SDL_GetError() for more information.
637 *
638 * \since This function is available since SDL 3.0.0.
639 */
640extern DECLSPEC SDL_Joystick *SDLCALL SDL_GetGamepadJoystick(SDL_Gamepad *gamepad);
641
642/**
643 * Set the state of gamepad event processing.
644 *
645 * If gamepad events are disabled, you must call SDL_UpdateGamepads() yourself
646 * and check the state of the gamepad when you want gamepad information.
647 *
648 * \param enabled whether to process gamepad events or not
649 *
650 * \since This function is available since SDL 3.0.0.
651 *
652 * \sa SDL_GamepadEventsEnabled
653 */
654extern DECLSPEC void SDLCALL SDL_SetGamepadEventsEnabled(SDL_bool enabled);
655
656/**
657 * Query the state of gamepad event processing.
658 *
659 * If gamepad events are disabled, you must call SDL_UpdateGamepads() yourself
660 * and check the state of the gamepad when you want gamepad information.
661 *
662 * \returns SDL_TRUE if gamepad events are being processed, SDL_FALSE
663 * otherwise.
664 *
665 * \since This function is available since SDL 3.0.0.
666 *
667 * \sa SDL_SetGamepadEventsEnabled
668 */
669extern DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void);
670
671/**
672 * Manually pump gamepad updates if not using the loop.
673 *
674 * This function is called automatically by the event loop if events are
675 * enabled. Under such circumstances, it will not be necessary to call this
676 * function.
677 *
678 * \since This function is available since SDL 3.0.0.
679 */
680extern DECLSPEC void SDLCALL SDL_UpdateGamepads(void);
681
682
683/**
684 * Convert a string into SDL_GamepadAxis enum.
685 *
686 * This function is called internally to translate SDL_Gamepad mapping strings
687 * for the underlying joystick device into the consistent SDL_Gamepad mapping.
688 * You do not normally need to call this function unless you are parsing
689 * SDL_Gamepad mappings in your own code.
690 *
691 * Note specially that "righttrigger" and "lefttrigger" map to
692 * `SDL_GAMEPAD_AXIS_RIGHT_TRIGGER` and `SDL_GAMEPAD_AXIS_LEFT_TRIGGER`,
693 * respectively.
694 *
695 * \param str string representing a SDL_Gamepad axis
696 * \returns the SDL_GamepadAxis enum corresponding to the input string, or
697 * `SDL_GAMEPAD_AXIS_INVALID` if no match was found.
698 *
699 * \since This function is available since SDL 3.0.0.
700 *
701 * \sa SDL_GetGamepadStringForAxis
702 */
703extern DECLSPEC SDL_GamepadAxis SDLCALL SDL_GetGamepadAxisFromString(const char *str);
704
705/**
706 * Convert from an SDL_GamepadAxis enum to a string.
707 *
708 * The caller should not SDL_free() the returned string.
709 *
710 * \param axis an enum value for a given SDL_GamepadAxis
711 * \returns a string for the given axis, or NULL if an invalid axis is
712 * specified. The string returned is of the format used by
713 * SDL_Gamepad mapping strings.
714 *
715 * \since This function is available since SDL 3.0.0.
716 *
717 * \sa SDL_GetGamepadAxisFromString
718 */
719extern DECLSPEC const char* SDLCALL SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis);
720
721/**
722 * Get the SDL joystick layer binding for a gamepad axis mapping.
723 *
724 * \param gamepad a gamepad
725 * \param axis an axis enum value (one of the SDL_GamepadAxis values)
726 * \returns a SDL_GamepadBinding describing the bind. On failure (like the
727 * given Controller axis doesn't exist on the device), its
728 * `.bindType` will be `SDL_GAMEPAD_BINDTYPE_NONE`.
729 *
730 * \since This function is available since SDL 3.0.0.
731 *
732 * \sa SDL_GetGamepadBindForButton
733 */
735
736/**
737 * Query whether a gamepad has a given axis.
738 *
739 * This merely reports whether the gamepad's mapping defined this axis, as
740 * that is all the information SDL has about the physical device.
741 *
742 * \param gamepad a gamepad
743 * \param axis an axis enum value (an SDL_GamepadAxis value)
744 * \returns SDL_TRUE if the gamepad has this axis, SDL_FALSE otherwise.
745 *
746 * \since This function is available since SDL 3.0.0.
747 */
748extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis);
749
750/**
751 * Get the current state of an axis control on a gamepad.
752 *
753 * The axis indices start at index 0.
754 *
755 * The state is a value ranging from -32768 to 32767. Triggers, however, range
756 * from 0 to 32767 (they never return a negative value).
757 *
758 * \param gamepad a gamepad
759 * \param axis an axis index (one of the SDL_GamepadAxis values)
760 * \returns axis state (including 0) on success or 0 (also) on failure; call
761 * SDL_GetError() for more information.
762 *
763 * \since This function is available since SDL 3.0.0.
764 *
765 * \sa SDL_GetGamepadButton
766 */
767extern DECLSPEC Sint16 SDLCALL SDL_GetGamepadAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis);
768
769/**
770 * Convert a string into an SDL_GamepadButton enum.
771 *
772 * This function is called internally to translate SDL_Gamepad mapping strings
773 * for the underlying joystick device into the consistent SDL_Gamepad mapping.
774 * You do not normally need to call this function unless you are parsing
775 * SDL_Gamepad mappings in your own code.
776 *
777 * \param str string representing a SDL_Gamepad axis
778 * \returns the SDL_GamepadButton enum corresponding to the input string, or
779 * `SDL_GAMEPAD_AXIS_INVALID` if no match was found.
780 *
781 * \since This function is available since SDL 3.0.0.
782 */
783extern DECLSPEC SDL_GamepadButton SDLCALL SDL_GetGamepadButtonFromString(const char *str);
784
785/**
786 * Convert from an SDL_GamepadButton enum to a string.
787 *
788 * The caller should not SDL_free() the returned string.
789 *
790 * \param button an enum value for a given SDL_GamepadButton
791 * \returns a string for the given button, or NULL if an invalid button is
792 * specified. The string returned is of the format used by
793 * SDL_Gamepad mapping strings.
794 *
795 * \since This function is available since SDL 3.0.0.
796 *
797 * \sa SDL_GetGamepadButtonFromString
798 */
799extern DECLSPEC const char* SDLCALL SDL_GetGamepadStringForButton(SDL_GamepadButton button);
800
801/**
802 * Get the SDL joystick layer binding for a gamepad button mapping.
803 *
804 * \param gamepad a gamepad
805 * \param button an button enum value (an SDL_GamepadButton value)
806 * \returns a SDL_GamepadBinding describing the bind. On failure (like the
807 * given Controller button doesn't exist on the device), its
808 * `.bindType` will be `SDL_GAMEPAD_BINDTYPE_NONE`.
809 *
810 * \since This function is available since SDL 3.0.0.
811 *
812 * \sa SDL_GetGamepadBindForAxis
813 */
815
816/**
817 * Query whether a gamepad has a given button.
818 *
819 * This merely reports whether the gamepad's mapping defined this button, as
820 * that is all the information SDL has about the physical device.
821 *
822 * \param gamepad a gamepad
823 * \param button a button enum value (an SDL_GamepadButton value)
824 * \returns SDL_TRUE if the gamepad has this button, SDL_FALSE otherwise.
825 *
826 * \since This function is available since SDL 3.0.0.
827 */
828extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);
829
830/**
831 * Get the current state of a button on a gamepad.
832 *
833 * \param gamepad a gamepad
834 * \param button a button index (one of the SDL_GamepadButton values)
835 * \returns 1 for pressed state or 0 for not pressed state or error; call
836 * SDL_GetError() for more information.
837 *
838 * \since This function is available since SDL 3.0.0.
839 *
840 * \sa SDL_GetGamepadAxis
841 */
842extern DECLSPEC Uint8 SDLCALL SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);
843
844/**
845 * Get the number of touchpads on a gamepad.
846 *
847 * \param gamepad a gamepad
848 * \returns number of touchpads
849 *
850 * \since This function is available since SDL 3.0.0.
851 */
852extern DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpads(SDL_Gamepad *gamepad);
853
854/**
855 * Get the number of supported simultaneous fingers on a touchpad on a game
856 * gamepad.
857 *
858 * \param gamepad a gamepad
859 * \param touchpad a touchpad
860 * \returns number of supported simultaneous fingers
861 *
862 * \since This function is available since SDL 3.0.0.
863 */
864extern DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpadFingers(SDL_Gamepad *gamepad, int touchpad);
865
866/**
867 * Get the current state of a finger on a touchpad on a gamepad.
868 *
869 * \param gamepad a gamepad
870 * \param touchpad a touchpad
871 * \param finger a finger
872 * \param state filled with state
873 * \param x filled with x position
874 * \param y filled with y position
875 * \param pressure filled with pressure value
876 * \returns 0 on success or a negative error code on failure; call
877 * SDL_GetError() for more information.
878 *
879 * \since This function is available since SDL 3.0.0.
880 */
881extern DECLSPEC int SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure);
882
883/**
884 * Return whether a gamepad has a particular sensor.
885 *
886 * \param gamepad The gamepad to query
887 * \param type The type of sensor to query
888 * \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise.
889 *
890 * \since This function is available since SDL 3.0.0.
891 */
893
894/**
895 * Set whether data reporting for a gamepad sensor is enabled.
896 *
897 * \param gamepad The gamepad to update
898 * \param type The type of sensor to enable/disable
899 * \param enabled Whether data reporting should be enabled
900 * \returns 0 on success or a negative error code on failure; call
901 * SDL_GetError() for more information.
902 *
903 * \since This function is available since SDL 3.0.0.
904 */
906
907/**
908 * Query whether sensor data reporting is enabled for a gamepad.
909 *
910 * \param gamepad The gamepad to query
911 * \param type The type of sensor to query
912 * \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise.
913 *
914 * \since This function is available since SDL 3.0.0.
915 */
917
918/**
919 * Get the data rate (number of events per second) of a gamepad sensor.
920 *
921 * \param gamepad The gamepad to query
922 * \param type The type of sensor to query
923 * \returns the data rate, or 0.0f if the data rate is not available.
924 *
925 * \since This function is available since SDL 3.0.0.
926 */
927extern DECLSPEC float SDLCALL SDL_GetGamepadSensorDataRate(SDL_Gamepad *gamepad, SDL_SensorType type);
928
929/**
930 * Get the current state of a gamepad sensor.
931 *
932 * The number of values and interpretation of the data is sensor dependent.
933 * See SDL_sensor.h for the details for each type of sensor.
934 *
935 * \param gamepad The gamepad to query
936 * \param type The type of sensor to query
937 * \param data A pointer filled with the current sensor state
938 * \param num_values The number of values to write to data
939 * \returns 0 on success or a negative error code on failure; call
940 * SDL_GetError() for more information.
941 *
942 * \since This function is available since SDL 3.0.0.
943 */
944extern DECLSPEC int SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values);
945
946/**
947 * Start a rumble effect on a gamepad.
948 *
949 * Each call to this function cancels any previous rumble effect, and calling
950 * it with 0 intensity stops any rumbling.
951 *
952 * \param gamepad The gamepad to vibrate
953 * \param low_frequency_rumble The intensity of the low frequency (left)
954 * rumble motor, from 0 to 0xFFFF
955 * \param high_frequency_rumble The intensity of the high frequency (right)
956 * rumble motor, from 0 to 0xFFFF
957 * \param duration_ms The duration of the rumble effect, in milliseconds
958 * \returns 0, or -1 if rumble isn't supported on this gamepad
959 *
960 * \since This function is available since SDL 3.0.0.
961 *
962 * \sa SDL_GamepadHasRumble
963 */
964extern DECLSPEC int SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
965
966/**
967 * Start a rumble effect in the gamepad's triggers.
968 *
969 * Each call to this function cancels any previous trigger rumble effect, and
970 * calling it with 0 intensity stops any rumbling.
971 *
972 * Note that this is rumbling of the _triggers_ and not the gamepad as a
973 * whole. This is currently only supported on Xbox One gamepads. If you want
974 * the (more common) whole-gamepad rumble, use SDL_RumbleGamepad() instead.
975 *
976 * \param gamepad The gamepad to vibrate
977 * \param left_rumble The intensity of the left trigger rumble motor, from 0
978 * to 0xFFFF
979 * \param right_rumble The intensity of the right trigger rumble motor, from 0
980 * to 0xFFFF
981 * \param duration_ms The duration of the rumble effect, in milliseconds
982 * \returns 0 on success or a negative error code on failure; call
983 * SDL_GetError() for more information.
984 *
985 * \since This function is available since SDL 3.0.0.
986 *
987 * \sa SDL_GamepadHasRumbleTriggers
988 */
989extern DECLSPEC int SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
990
991/**
992 * Query whether a gamepad has an LED.
993 *
994 * \param gamepad The gamepad to query
995 * \returns SDL_TRUE, or SDL_FALSE if this gamepad does not have a modifiable
996 * LED
997 *
998 * \since This function is available since SDL 3.0.0.
999 */
1000extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasLED(SDL_Gamepad *gamepad);
1001
1002/**
1003 * Query whether a gamepad has rumble support.
1004 *
1005 * \param gamepad The gamepad to query
1006 * \returns SDL_TRUE, or SDL_FALSE if this gamepad does not have rumble
1007 * support
1008 *
1009 * \since This function is available since SDL 3.0.0.
1010 *
1011 * \sa SDL_RumbleGamepad
1012 */
1013extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasRumble(SDL_Gamepad *gamepad);
1014
1015/**
1016 * Query whether a gamepad has rumble support on triggers.
1017 *
1018 * \param gamepad The gamepad to query
1019 * \returns SDL_TRUE, or SDL_FALSE if this gamepad does not have trigger
1020 * rumble support
1021 *
1022 * \since This function is available since SDL 3.0.0.
1023 *
1024 * \sa SDL_RumbleGamepadTriggers
1025 */
1026extern DECLSPEC SDL_bool SDLCALL SDL_GamepadHasRumbleTriggers(SDL_Gamepad *gamepad);
1027
1028/**
1029 * Update a gamepad's LED color.
1030 *
1031 * \param gamepad The gamepad to update
1032 * \param red The intensity of the red LED
1033 * \param green The intensity of the green LED
1034 * \param blue The intensity of the blue LED
1035 * \returns 0 on success or a negative error code on failure; call
1036 * SDL_GetError() for more information.
1037 *
1038 * \since This function is available since SDL 3.0.0.
1039 */
1040extern DECLSPEC int SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue);
1041
1042/**
1043 * Send a gamepad specific effect packet
1044 *
1045 * \param gamepad The gamepad to affect
1046 * \param data The data to send to the gamepad
1047 * \param size The size of the data to send to the gamepad
1048 * \returns 0 on success or a negative error code on failure; call
1049 * SDL_GetError() for more information.
1050 *
1051 * \since This function is available since SDL 3.0.0.
1052 */
1053extern DECLSPEC int SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size);
1054
1055/**
1056 * Close a gamepad previously opened with SDL_OpenGamepad().
1057 *
1058 * \param gamepad a gamepad identifier previously returned by
1059 * SDL_OpenGamepad()
1060 *
1061 * \since This function is available since SDL 3.0.0.
1062 *
1063 * \sa SDL_OpenGamepad
1064 */
1065extern DECLSPEC void SDLCALL SDL_CloseGamepad(SDL_Gamepad *gamepad);
1066
1067/**
1068 * Return the sfSymbolsName for a given button on a gamepad on Apple
1069 * platforms.
1070 *
1071 * \param gamepad the gamepad to query
1072 * \param button a button on the gamepad
1073 * \returns the sfSymbolsName or NULL if the name can't be found
1074 *
1075 * \since This function is available since SDL 3.0.0.
1076 *
1077 * \sa SDL_GetGamepadAppleSFSymbolsNameForAxis
1078 */
1079extern DECLSPEC const char* SDLCALL SDL_GetGamepadAppleSFSymbolsNameForButton(SDL_Gamepad *gamepad, SDL_GamepadButton button);
1080
1081/**
1082 * Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
1083 *
1084 * \param gamepad the gamepad to query
1085 * \param axis an axis on the gamepad
1086 * \returns the sfSymbolsName or NULL if the name can't be found
1087 *
1088 * \since This function is available since SDL 3.0.0.
1089 *
1090 * \sa SDL_GetGamepadAppleSFSymbolsNameForButton
1091 */
1092extern DECLSPEC const char* SDLCALL SDL_GetGamepadAppleSFSymbolsNameForAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis);
1093
1094
1095/* Ends C function definitions when using C++ */
1096#ifdef __cplusplus
1097}
1098#endif
1099#include <SDL3/SDL_close_code.h>
1100
1101#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)
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)
int SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index)
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