SDL 3.0
SDL_joystick.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 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_joystick.h
24 *
25 * Include file for SDL joystick event handling
26 *
27 * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
28 * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
29 *
30 * The term "player_index" is the number assigned to a player on a specific
31 * controller. For XInput controllers this returns the XInput user index.
32 * Many joysticks will not be able to supply this information.
33 *
34 * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
35 * the device (a X360 wired controller for example). This identifier is platform dependent.
36 */
37
38#ifndef SDL_joystick_h_
39#define SDL_joystick_h_
40
41#include <SDL3/SDL_stdinc.h>
42#include <SDL3/SDL_error.h>
43#include <SDL3/SDL_guid.h>
44#include <SDL3/SDL_mutex.h>
45#include <SDL3/SDL_properties.h>
46
47#include <SDL3/SDL_begin_code.h>
48/* Set up for C function definitions, even when using C++ */
49#ifdef __cplusplus
50extern "C" {
51#endif
52
53/**
54 * \file SDL_joystick.h
55 *
56 * In order to use these functions, SDL_Init() must have been called
57 * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
58 * for joysticks, and load appropriate drivers.
59 *
60 * If you would like to receive joystick updates while the application
61 * is in the background, you should set the following hint before calling
62 * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS
63 */
64
65/**
66 * The joystick structure used to identify an SDL joystick
67 */
68#ifdef SDL_THREAD_SAFETY_ANALYSIS
69extern SDL_Mutex *SDL_joystick_lock;
70#endif
71struct SDL_Joystick;
73
74/* A structure that encodes the stable unique id for a joystick device */
76
77/**
78 * This is a unique ID for a joystick for the time it is connected to the system,
79 * and is never reused for the lifetime of the application. If the joystick is
80 * disconnected and reconnected, it will get a new ID.
81 *
82 * The ID value starts at 1 and increments from there. The value 0 is an invalid ID.
83 */
85
99
110
111#define SDL_JOYSTICK_AXIS_MAX 32767
112#define SDL_JOYSTICK_AXIS_MIN -32768
113
114/* Set max recognized G-force from accelerometer
115 See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed
116 */
117#define SDL_IPHONE_MAX_GFORCE 5.0
118
119
120/* Function prototypes */
121
122/**
123 * Locking for atomic access to the joystick API
124 *
125 * The SDL joystick functions are thread-safe, however you can lock the
126 * joysticks while processing to guarantee that the joystick list won't change
127 * and joystick and gamepad events will not be delivered.
128 *
129 * \since This function is available since SDL 3.0.0.
130 */
131extern DECLSPEC void SDLCALL SDL_LockJoysticks(void) SDL_ACQUIRE(SDL_joystick_lock);
132
133/**
134 * Unlocking for atomic access to the joystick API
135 *
136 * \since This function is available since SDL 3.0.0.
137 */
138extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void) SDL_RELEASE(SDL_joystick_lock);
139
140/**
141 * Return whether a joystick is currently connected.
142 *
143 * \returns SDL_TRUE if a joystick is connected, SDL_FALSE otherwise.
144 *
145 * \since This function is available since SDL 3.0.0.
146 *
147 * \sa SDL_GetJoysticks
148 */
149extern DECLSPEC SDL_bool SDLCALL SDL_HasJoystick(void);
150
151/**
152 * Get a list of currently connected joysticks.
153 *
154 * \param count a pointer filled in with the number of joysticks returned
155 * \returns a 0 terminated array of joystick instance IDs which should be
156 * freed with SDL_free(), or NULL on error; call SDL_GetError() for
157 * more details.
158 *
159 * \since This function is available since SDL 3.0.0.
160 *
161 * \sa SDL_HasJoystick
162 * \sa SDL_OpenJoystick
163 */
164extern DECLSPEC SDL_JoystickID *SDLCALL SDL_GetJoysticks(int *count);
165
166/**
167 * Get the implementation dependent name of a joystick.
168 *
169 * This can be called before any joysticks are opened.
170 *
171 * \param instance_id the joystick instance ID
172 * \returns the name of the selected joystick. If no name can be found, this
173 * function returns NULL; call SDL_GetError() for more information.
174 *
175 * \since This function is available since SDL 3.0.0.
176 *
177 * \sa SDL_GetJoystickName
178 * \sa SDL_GetJoysticks
179 */
180extern DECLSPEC const char *SDLCALL SDL_GetJoystickInstanceName(SDL_JoystickID instance_id);
181
182/**
183 * Get the implementation dependent path of a joystick.
184 *
185 * This can be called before any joysticks are opened.
186 *
187 * \param instance_id the joystick instance ID
188 * \returns the path of the selected joystick. If no path can be found, this
189 * function returns NULL; call SDL_GetError() for more information.
190 *
191 * \since This function is available since SDL 3.0.0.
192 *
193 * \sa SDL_GetJoystickPath
194 * \sa SDL_GetJoysticks
195 */
196extern DECLSPEC const char *SDLCALL SDL_GetJoystickInstancePath(SDL_JoystickID instance_id);
197
198/**
199 * Get the player index of a joystick.
200 *
201 * This can be called before any joysticks are opened.
202 *
203 * \param instance_id the joystick instance ID
204 * \returns the player index of a joystick, or -1 if it's not available
205 *
206 * \since This function is available since SDL 3.0.0.
207 *
208 * \sa SDL_GetJoystickPlayerIndex
209 * \sa SDL_GetJoysticks
210 */
211extern DECLSPEC int SDLCALL SDL_GetJoystickInstancePlayerIndex(SDL_JoystickID instance_id);
212
213/**
214 * Get the implementation-dependent GUID of a joystick.
215 *
216 * This can be called before any joysticks are opened.
217 *
218 * \param instance_id the joystick instance ID
219 * \returns the GUID of the selected joystick. If called with an invalid
220 * instance_id, this function returns a zero GUID.
221 *
222 * \since This function is available since SDL 3.0.0.
223 *
224 * \sa SDL_GetJoystickGUID
225 * \sa SDL_GetJoystickGUIDString
226 */
228
229/**
230 * Get the USB vendor ID of a joystick, if available.
231 *
232 * This can be called before any joysticks are opened. If the vendor ID isn't
233 * available this function returns 0.
234 *
235 * \param instance_id the joystick instance ID
236 * \returns the USB vendor ID of the selected joystick. If called with an
237 * invalid instance_id, this function returns 0.
238 *
239 * \since This function is available since SDL 3.0.0.
240 *
241 * \sa SDL_GetJoystickVendor
242 * \sa SDL_GetJoysticks
243 */
244extern DECLSPEC Uint16 SDLCALL SDL_GetJoystickInstanceVendor(SDL_JoystickID instance_id);
245
246/**
247 * Get the USB product ID of a joystick, if available.
248 *
249 * This can be called before any joysticks are opened. If the product ID isn't
250 * available this function returns 0.
251 *
252 * \param instance_id the joystick instance ID
253 * \returns the USB product ID of the selected joystick. If called with an
254 * invalid instance_id, this function returns 0.
255 *
256 * \since This function is available since SDL 3.0.0.
257 *
258 * \sa SDL_GetJoystickProduct
259 * \sa SDL_GetJoysticks
260 */
261extern DECLSPEC Uint16 SDLCALL SDL_GetJoystickInstanceProduct(SDL_JoystickID instance_id);
262
263/**
264 * Get the product version of a joystick, if available.
265 *
266 * This can be called before any joysticks are opened. If the product version
267 * isn't available this function returns 0.
268 *
269 * \param instance_id the joystick instance ID
270 * \returns the product version of the selected joystick. If called with an
271 * invalid instance_id, this function returns 0.
272 *
273 * \since This function is available since SDL 3.0.0.
274 *
275 * \sa SDL_GetJoystickProductVersion
276 * \sa SDL_GetJoysticks
277 */
279
280/**
281 * Get the type of a joystick, if available.
282 *
283 * This can be called before any joysticks are opened.
284 *
285 * \param instance_id the joystick instance ID
286 * \returns the SDL_JoystickType of the selected joystick. If called with an
287 * invalid instance_id, this function returns
288 * `SDL_JOYSTICK_TYPE_UNKNOWN`.
289 *
290 * \since This function is available since SDL 3.0.0.
291 *
292 * \sa SDL_GetJoystickType
293 * \sa SDL_GetJoysticks
294 */
296
297/**
298 * Open a joystick for use.
299 *
300 * The joystick subsystem must be initialized before a joystick can be opened
301 * for use.
302 *
303 * \param instance_id the joystick instance ID
304 * \returns a joystick identifier or NULL if an error occurred; call
305 * SDL_GetError() for more information.
306 *
307 * \since This function is available since SDL 3.0.0.
308 *
309 * \sa SDL_CloseJoystick
310 */
311extern DECLSPEC SDL_Joystick *SDLCALL SDL_OpenJoystick(SDL_JoystickID instance_id);
312
313/**
314 * Get the SDL_Joystick associated with an instance ID, if it has been opened.
315 *
316 * \param instance_id the instance ID to get the SDL_Joystick for
317 * \returns an SDL_Joystick on success or NULL on failure or if it hasn't been
318 * opened yet; call SDL_GetError() for more information.
319 *
320 * \since This function is available since SDL 3.0.0.
321 */
322extern DECLSPEC SDL_Joystick *SDLCALL SDL_GetJoystickFromInstanceID(SDL_JoystickID instance_id);
323
324/**
325 * Get the SDL_Joystick associated with a player index.
326 *
327 * \param player_index the player index to get the SDL_Joystick for
328 * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError()
329 * for more information.
330 *
331 * \since This function is available since SDL 3.0.0.
332 *
333 * \sa SDL_GetJoystickPlayerIndex
334 * \sa SDL_SetJoystickPlayerIndex
335 */
336extern DECLSPEC SDL_Joystick *SDLCALL SDL_GetJoystickFromPlayerIndex(int player_index);
337
338/**
339 * Attach a new virtual joystick.
340 *
341 * \param type type of joystick
342 * \param naxes number of axes
343 * \param nbuttons number of buttons
344 * \param nhats number of hats
345 * \returns the joystick instance ID, or 0 if an error occurred; call
346 * SDL_GetError() for more information.
347 *
348 * \since This function is available since SDL 3.0.0.
349 *
350 * \sa SDL_AttachVirtualJoystickEx
351 * \sa SDL_DetachVirtualJoystick
352 */
354 int naxes,
355 int nbuttons,
356 int nhats);
357
358/**
359 * The structure that defines an extended virtual joystick description
360 *
361 * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_AttachVirtualJoystickEx()
362 * All other elements of this structure are optional and can be left 0.
363 *
364 * \sa SDL_AttachVirtualJoystickEx
365 */
367{
368 Uint16 version; /**< `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` */
369 Uint16 type; /**< `SDL_JoystickType` */
370 Uint16 naxes; /**< the number of axes on this joystick */
371 Uint16 nbuttons; /**< the number of buttons on this joystick */
372 Uint16 nhats; /**< the number of hats on this joystick */
373 Uint16 vendor_id; /**< the USB vendor ID of this joystick */
374 Uint16 product_id; /**< the USB product ID of this joystick */
375 Uint16 padding; /**< unused */
376 Uint32 button_mask; /**< A mask of which buttons are valid for this controller
377 e.g. (1 << SDL_GAMEPAD_BUTTON_SOUTH) */
378 Uint32 axis_mask; /**< A mask of which axes are valid for this controller
379 e.g. (1 << SDL_GAMEPAD_AXIS_LEFTX) */
380 const char *name; /**< the name of the joystick */
381
382 void *userdata; /**< User data pointer passed to callbacks */
383 void (SDLCALL *Update)(void *userdata); /**< Called when the joystick state should be updated */
384 void (SDLCALL *SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */
385 int (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_RumbleJoystick() */
386 int (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_RumbleJoystickTriggers() */
387 int (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_SetJoystickLED() */
388 int (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_SendJoystickEffect() */
389
391
392/**
393 * The current version of the SDL_VirtualJoystickDesc structure
394 */
395#define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1
396
397/**
398 * Attach a new virtual joystick with extended properties.
399 *
400 * \param desc Joystick description
401 * \returns the joystick instance ID, or 0 if an error occurred; call
402 * SDL_GetError() for more information.
403 *
404 * \since This function is available since SDL 3.0.0.
405 *
406 * \sa SDL_AttachVirtualJoystick
407 * \sa SDL_DetachVirtualJoystick
408 */
410
411/**
412 * Detach a virtual joystick.
413 *
414 * \param instance_id the joystick instance ID, previously returned from
415 * SDL_AttachVirtualJoystick()
416 * \returns 0 on success or a negative error code on failure; call
417 * SDL_GetError() for more information.
418 *
419 * \since This function is available since SDL 3.0.0.
420 *
421 * \sa SDL_AttachVirtualJoystick
422 * \sa SDL_AttachVirtualJoystickEx
423 */
424extern DECLSPEC int SDLCALL SDL_DetachVirtualJoystick(SDL_JoystickID instance_id);
425
426/**
427 * Query whether or not a joystick is virtual.
428 *
429 * \param instance_id the joystick instance ID
430 * \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise.
431 *
432 * \since This function is available since SDL 3.0.0.
433 */
434extern DECLSPEC SDL_bool SDLCALL SDL_IsJoystickVirtual(SDL_JoystickID instance_id);
435
436/**
437 * Set values on an opened, virtual-joystick's axis.
438 *
439 * Please note that values set here will not be applied until the next call to
440 * SDL_UpdateJoysticks, which can either be called directly, or can be called
441 * indirectly through various other SDL APIs, including, but not limited to
442 * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout,
443 * SDL_WaitEvent.
444 *
445 * Note that when sending trigger axes, you should scale the value to the full
446 * range of Sint16. For example, a trigger at rest would have the value of
447 * `SDL_JOYSTICK_AXIS_MIN`.
448 *
449 * \param joystick the virtual joystick on which to set state.
450 * \param axis the specific axis on the virtual joystick to set.
451 * \param value the new value for the specified axis.
452 * \returns 0 on success or a negative error code on failure; call
453 * SDL_GetError() for more information.
454 *
455 * \since This function is available since SDL 3.0.0.
456 */
457extern DECLSPEC int SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value);
458
459/**
460 * Set values on an opened, virtual-joystick's button.
461 *
462 * Please note that values set here will not be applied until the next call to
463 * SDL_UpdateJoysticks, which can either be called directly, or can be called
464 * indirectly through various other SDL APIs, including, but not limited to
465 * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout,
466 * SDL_WaitEvent.
467 *
468 * \param joystick the virtual joystick on which to set state.
469 * \param button the specific button on the virtual joystick to set.
470 * \param value the new value for the specified button.
471 * \returns 0 on success or a negative error code on failure; call
472 * SDL_GetError() for more information.
473 *
474 * \since This function is available since SDL 3.0.0.
475 */
476extern DECLSPEC int SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value);
477
478/**
479 * Set values on an opened, virtual-joystick's hat.
480 *
481 * Please note that values set here will not be applied until the next call to
482 * SDL_UpdateJoysticks, which can either be called directly, or can be called
483 * indirectly through various other SDL APIs, including, but not limited to
484 * the following: SDL_PollEvent, SDL_PumpEvents, SDL_WaitEventTimeout,
485 * SDL_WaitEvent.
486 *
487 * \param joystick the virtual joystick on which to set state.
488 * \param hat the specific hat on the virtual joystick to set.
489 * \param value the new value for the specified hat.
490 * \returns 0 on success or a negative error code on failure; call
491 * SDL_GetError() for more information.
492 *
493 * \since This function is available since SDL 3.0.0.
494 */
495extern DECLSPEC int SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value);
496
497/**
498 * Get the properties associated with a joystick.
499 *
500 * The following read-only properties are provided by SDL:
501 *
502 * - `SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN`: true if this joystick has an
503 * LED that has adjustable brightness
504 * - `SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN`: true if this joystick has an LED
505 * that has adjustable color
506 * - `SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN`: true if this joystick has a
507 * player LED
508 * - `SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN`: true if this joystick has
509 * left/right rumble
510 * - `SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN`: true if this joystick has
511 * simple trigger rumble
512 *
513 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
514 * \returns a valid property ID on success or 0 on failure; call
515 * SDL_GetError() for more information.
516 *
517 * \since This function is available since SDL 3.0.0.
518 *
519 * \sa SDL_GetProperty
520 * \sa SDL_SetProperty
521 */
522extern DECLSPEC SDL_PropertiesID SDLCALL SDL_GetJoystickProperties(SDL_Joystick *joystick);
523
524#define SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN "SDL.joystick.cap.mono_led"
525#define SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN "SDL.joystick.cap.rgb_led"
526#define SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN "SDL.joystick.cap.player_led"
527#define SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN "SDL.joystick.cap.rumble"
528#define SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN "SDL.joystick.cap.trigger_rumble"
529
530/**
531 * Get the implementation dependent name of a joystick.
532 *
533 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
534 * \returns the name of the selected joystick. If no name can be found, this
535 * function returns NULL; call SDL_GetError() for more information.
536 *
537 * \since This function is available since SDL 3.0.0.
538 *
539 * \sa SDL_GetJoystickInstanceName
540 */
541extern DECLSPEC const char *SDLCALL SDL_GetJoystickName(SDL_Joystick *joystick);
542
543/**
544 * Get the implementation dependent path of a joystick.
545 *
546 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
547 * \returns the path of the selected joystick. If no path can be found, this
548 * function returns NULL; call SDL_GetError() for more information.
549 *
550 * \since This function is available since SDL 3.0.0.
551 *
552 * \sa SDL_GetJoystickInstancePath
553 */
554extern DECLSPEC const char *SDLCALL SDL_GetJoystickPath(SDL_Joystick *joystick);
555
556/**
557 * Get the player index of an opened joystick.
558 *
559 * For XInput controllers this returns the XInput user index. Many joysticks
560 * will not be able to supply this information.
561 *
562 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
563 * \returns the player index, or -1 if it's not available.
564 *
565 * \since This function is available since SDL 3.0.0.
566 *
567 * \sa SDL_SetJoystickPlayerIndex
568 */
569extern DECLSPEC int SDLCALL SDL_GetJoystickPlayerIndex(SDL_Joystick *joystick);
570
571/**
572 * Set the player index of an opened joystick.
573 *
574 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
575 * \param player_index Player index to assign to this joystick, or -1 to clear
576 * the player index and turn off player LEDs.
577 * \returns 0 on success or a negative error code on failure; call
578 * SDL_GetError() for more information.
579 *
580 * \since This function is available since SDL 3.0.0.
581 *
582 * \sa SDL_GetJoystickPlayerIndex
583 */
584extern DECLSPEC int SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index);
585
586/**
587 * Get the implementation-dependent GUID for the joystick.
588 *
589 * This function requires an open joystick.
590 *
591 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
592 * \returns the GUID of the given joystick. If called on an invalid index,
593 * this function returns a zero GUID; call SDL_GetError() for more
594 * information.
595 *
596 * \since This function is available since SDL 3.0.0.
597 *
598 * \sa SDL_GetJoystickInstanceGUID
599 * \sa SDL_GetJoystickGUIDString
600 */
601extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_GetJoystickGUID(SDL_Joystick *joystick);
602
603/**
604 * Get the USB vendor ID of an opened joystick, if available.
605 *
606 * If the vendor ID isn't available this function returns 0.
607 *
608 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
609 * \returns the USB vendor ID of the selected joystick, or 0 if unavailable.
610 *
611 * \since This function is available since SDL 3.0.0.
612 *
613 * \sa SDL_GetJoystickInstanceVendor
614 */
615extern DECLSPEC Uint16 SDLCALL SDL_GetJoystickVendor(SDL_Joystick *joystick);
616
617/**
618 * Get the USB product ID of an opened joystick, if available.
619 *
620 * If the product ID isn't available this function returns 0.
621 *
622 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
623 * \returns the USB product ID of the selected joystick, or 0 if unavailable.
624 *
625 * \since This function is available since SDL 3.0.0.
626 *
627 * \sa SDL_GetJoystickInstanceProduct
628 */
629extern DECLSPEC Uint16 SDLCALL SDL_GetJoystickProduct(SDL_Joystick *joystick);
630
631/**
632 * Get the product version of an opened joystick, if available.
633 *
634 * If the product version isn't available this function returns 0.
635 *
636 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
637 * \returns the product version of the selected joystick, or 0 if unavailable.
638 *
639 * \since This function is available since SDL 3.0.0.
640 *
641 * \sa SDL_GetJoystickInstanceProductVersion
642 */
643extern DECLSPEC Uint16 SDLCALL SDL_GetJoystickProductVersion(SDL_Joystick *joystick);
644
645/**
646 * Get the firmware version of an opened joystick, if available.
647 *
648 * If the firmware version isn't available this function returns 0.
649 *
650 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
651 * \returns the firmware version of the selected joystick, or 0 if
652 * unavailable.
653 *
654 * \since This function is available since SDL 3.0.0.
655 */
656extern DECLSPEC Uint16 SDLCALL SDL_GetJoystickFirmwareVersion(SDL_Joystick *joystick);
657
658/**
659 * Get the serial number of an opened joystick, if available.
660 *
661 * Returns the serial number of the joystick, or NULL if it is not available.
662 *
663 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
664 * \returns the serial number of the selected joystick, or NULL if
665 * unavailable.
666 *
667 * \since This function is available since SDL 3.0.0.
668 */
669extern DECLSPEC const char * SDLCALL SDL_GetJoystickSerial(SDL_Joystick *joystick);
670
671/**
672 * Get the type of an opened joystick.
673 *
674 * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick()
675 * \returns the SDL_JoystickType of the selected joystick.
676 *
677 * \since This function is available since SDL 3.0.0.
678 *
679 * \sa SDL_GetJoystickInstanceType
680 */
681extern DECLSPEC SDL_JoystickType SDLCALL SDL_GetJoystickType(SDL_Joystick *joystick);
682
683/**
684 * Get an ASCII string representation for a given SDL_JoystickGUID.
685 *
686 * You should supply at least 33 bytes for pszGUID.
687 *
688 * \param guid the SDL_JoystickGUID you wish to convert to string
689 * \param pszGUID buffer in which to write the ASCII string
690 * \param cbGUID the size of pszGUID
691 * \returns 0 on success or a negative error code on failure; call
692 * SDL_GetError() for more information.
693 *
694 * \since This function is available since SDL 3.0.0.
695 *
696 * \sa SDL_GetJoystickInstanceGUID
697 * \sa SDL_GetJoystickGUID
698 * \sa SDL_GetJoystickGUIDFromString
699 */
700extern DECLSPEC int SDLCALL SDL_GetJoystickGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID);
701
702/**
703 * Convert a GUID string into a SDL_JoystickGUID structure.
704 *
705 * Performs no error checking. If this function is given a string containing
706 * an invalid GUID, the function will silently succeed, but the GUID generated
707 * will not be useful.
708 *
709 * \param pchGUID string containing an ASCII representation of a GUID
710 * \returns a SDL_JoystickGUID structure.
711 *
712 * \since This function is available since SDL 3.0.0.
713 *
714 * \sa SDL_GetJoystickGUIDString
715 */
716extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_GetJoystickGUIDFromString(const char *pchGUID);
717
718/**
719 * Get the device information encoded in a SDL_JoystickGUID structure
720 *
721 * \param guid the SDL_JoystickGUID you wish to get info about
722 * \param vendor A pointer filled in with the device VID, or 0 if not
723 * available
724 * \param product A pointer filled in with the device PID, or 0 if not
725 * available
726 * \param version A pointer filled in with the device version, or 0 if not
727 * available
728 * \param crc16 A pointer filled in with a CRC used to distinguish different
729 * products with the same VID/PID, or 0 if not available
730 *
731 * \since This function is available since SDL 3.0.0.
732 *
733 * \sa SDL_GetJoystickInstanceGUID
734 */
735extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version, Uint16 *crc16);
736
737/**
738 * Get the status of a specified joystick.
739 *
740 * \param joystick the joystick to query
741 * \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not;
742 * call SDL_GetError() for more information.
743 *
744 * \since This function is available since SDL 3.0.0.
745 */
746extern DECLSPEC SDL_bool SDLCALL SDL_JoystickConnected(SDL_Joystick *joystick);
747
748/**
749 * Get the instance ID of an opened joystick.
750 *
751 * \param joystick an SDL_Joystick structure containing joystick information
752 * \returns the instance ID of the specified joystick on success or 0 on
753 * failure; call SDL_GetError() for more information.
754 *
755 * \since This function is available since SDL 3.0.0.
756 */
757extern DECLSPEC SDL_JoystickID SDLCALL SDL_GetJoystickInstanceID(SDL_Joystick *joystick);
758
759/**
760 * Get the number of general axis controls on a joystick.
761 *
762 * Often, the directional pad on a game controller will either look like 4
763 * separate buttons or a POV hat, and not axes, but all of this is up to the
764 * device and platform.
765 *
766 * \param joystick an SDL_Joystick structure containing joystick information
767 * \returns the number of axis controls/number of axes on success or a
768 * negative error code on failure; call SDL_GetError() for more
769 * information.
770 *
771 * \since This function is available since SDL 3.0.0.
772 *
773 * \sa SDL_GetJoystickAxis
774 * \sa SDL_GetNumJoystickBalls
775 * \sa SDL_GetNumJoystickButtons
776 * \sa SDL_GetNumJoystickHats
777 */
778extern DECLSPEC int SDLCALL SDL_GetNumJoystickAxes(SDL_Joystick *joystick);
779
780/**
781 * Get the number of trackballs on a joystick.
782 *
783 * Joystick trackballs have only relative motion events associated with them
784 * and their state cannot be polled.
785 *
786 * Most joysticks do not have trackballs.
787 *
788 * \param joystick an SDL_Joystick structure containing joystick information
789 * \returns the number of trackballs on success or a negative error code on
790 * failure; call SDL_GetError() for more information.
791 *
792 * \since This function is available since SDL 3.0.0.
793 *
794 * \sa SDL_GetJoystickBall
795 * \sa SDL_GetNumJoystickAxes
796 * \sa SDL_GetNumJoystickButtons
797 * \sa SDL_GetNumJoystickHats
798 */
799extern DECLSPEC int SDLCALL SDL_GetNumJoystickBalls(SDL_Joystick *joystick);
800
801/**
802 * Get the number of POV hats on a joystick.
803 *
804 * \param joystick an SDL_Joystick structure containing joystick information
805 * \returns the number of POV hats on success or a negative error code on
806 * failure; call SDL_GetError() for more information.
807 *
808 * \since This function is available since SDL 3.0.0.
809 *
810 * \sa SDL_GetJoystickHat
811 * \sa SDL_GetNumJoystickAxes
812 * \sa SDL_GetNumJoystickBalls
813 * \sa SDL_GetNumJoystickButtons
814 */
815extern DECLSPEC int SDLCALL SDL_GetNumJoystickHats(SDL_Joystick *joystick);
816
817/**
818 * Get the number of buttons on a joystick.
819 *
820 * \param joystick an SDL_Joystick structure containing joystick information
821 * \returns the number of buttons on success or a negative error code on
822 * failure; call SDL_GetError() for more information.
823 *
824 * \since This function is available since SDL 3.0.0.
825 *
826 * \sa SDL_GetJoystickButton
827 * \sa SDL_GetNumJoystickAxes
828 * \sa SDL_GetNumJoystickBalls
829 * \sa SDL_GetNumJoystickHats
830 */
831extern DECLSPEC int SDLCALL SDL_GetNumJoystickButtons(SDL_Joystick *joystick);
832
833/**
834 * Set the state of joystick event processing.
835 *
836 * If joystick events are disabled, you must call SDL_UpdateJoysticks()
837 * yourself and check the state of the joystick when you want joystick
838 * information.
839 *
840 * \param enabled whether to process joystick events or not
841 *
842 * \since This function is available since SDL 3.0.0.
843 *
844 * \sa SDL_JoystickEventsEnabled
845 * \sa SDL_UpdateJoysticks
846 */
847extern DECLSPEC void SDLCALL SDL_SetJoystickEventsEnabled(SDL_bool enabled);
848
849/**
850 * Query the state of joystick event processing.
851 *
852 * If joystick events are disabled, you must call SDL_UpdateJoysticks()
853 * yourself and check the state of the joystick when you want joystick
854 * information.
855 *
856 * \returns SDL_TRUE if joystick events are being processed, SDL_FALSE
857 * otherwise.
858 *
859 * \since This function is available since SDL 3.0.0.
860 *
861 * \sa SDL_SetJoystickEventsEnabled
862 */
863extern DECLSPEC SDL_bool SDLCALL SDL_JoystickEventsEnabled(void);
864
865/**
866 * Update the current state of the open joysticks.
867 *
868 * This is called automatically by the event loop if any joystick events are
869 * enabled.
870 *
871 * \since This function is available since SDL 3.0.0.
872 */
873extern DECLSPEC void SDLCALL SDL_UpdateJoysticks(void);
874
875/**
876 * Get the current state of an axis control on a joystick.
877 *
878 * SDL makes no promises about what part of the joystick any given axis refers
879 * to. Your game should have some sort of configuration UI to let users
880 * specify what each axis should be bound to. Alternately, SDL's higher-level
881 * Game Controller API makes a great effort to apply order to this lower-level
882 * interface, so you know that a specific axis is the "left thumb stick," etc.
883 *
884 * The value returned by SDL_GetJoystickAxis() is a signed integer (-32768 to
885 * 32767) representing the current position of the axis. It may be necessary
886 * to impose certain tolerances on these values to account for jitter.
887 *
888 * \param joystick an SDL_Joystick structure containing joystick information
889 * \param axis the axis to query; the axis indices start at index 0
890 * \returns a 16-bit signed integer representing the current position of the
891 * axis or 0 on failure; call SDL_GetError() for more information.
892 *
893 * \since This function is available since SDL 3.0.0.
894 *
895 * \sa SDL_GetNumJoystickAxes
896 */
897extern DECLSPEC Sint16 SDLCALL SDL_GetJoystickAxis(SDL_Joystick *joystick, int axis);
898
899/**
900 * Get the initial state of an axis control on a joystick.
901 *
902 * The state is a value ranging from -32768 to 32767.
903 *
904 * The axis indices start at index 0.
905 *
906 * \param joystick an SDL_Joystick structure containing joystick information
907 * \param axis the axis to query; the axis indices start at index 0
908 * \param state Upon return, the initial value is supplied here.
909 * \returns SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
910 *
911 * \since This function is available since SDL 3.0.0.
912 */
913extern DECLSPEC SDL_bool SDLCALL SDL_GetJoystickAxisInitialState(SDL_Joystick *joystick, int axis, Sint16 *state);
914
915/**
916 * Get the ball axis change since the last poll.
917 *
918 * Trackballs can only return relative motion since the last call to
919 * SDL_GetJoystickBall(), these motion deltas are placed into `dx` and `dy`.
920 *
921 * Most joysticks do not have trackballs.
922 *
923 * \param joystick the SDL_Joystick to query
924 * \param ball the ball index to query; ball indices start at index 0
925 * \param dx stores the difference in the x axis position since the last poll
926 * \param dy stores the difference in the y axis position since the last poll
927 * \returns 0 on success or a negative error code on failure; call
928 * SDL_GetError() for more information.
929 *
930 * \since This function is available since SDL 3.0.0.
931 *
932 * \sa SDL_GetNumJoystickBalls
933 */
934extern DECLSPEC int SDLCALL SDL_GetJoystickBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
935
936/**
937 * \name Hat positions
938 */
939/* @{ */
940#define SDL_HAT_CENTERED 0x00
941#define SDL_HAT_UP 0x01
942#define SDL_HAT_RIGHT 0x02
943#define SDL_HAT_DOWN 0x04
944#define SDL_HAT_LEFT 0x08
945#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
946#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
947#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
948#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
949/* @} */
950
951/**
952 * Get the current state of a POV hat on a joystick.
953 *
954 * The returned value will be one of the following positions:
955 *
956 * - `SDL_HAT_CENTERED`
957 * - `SDL_HAT_UP`
958 * - `SDL_HAT_RIGHT`
959 * - `SDL_HAT_DOWN`
960 * - `SDL_HAT_LEFT`
961 * - `SDL_HAT_RIGHTUP`
962 * - `SDL_HAT_RIGHTDOWN`
963 * - `SDL_HAT_LEFTUP`
964 * - `SDL_HAT_LEFTDOWN`
965 *
966 * \param joystick an SDL_Joystick structure containing joystick information
967 * \param hat the hat index to get the state from; indices start at index 0
968 * \returns the current hat position.
969 *
970 * \since This function is available since SDL 3.0.0.
971 *
972 * \sa SDL_GetNumJoystickHats
973 */
974extern DECLSPEC Uint8 SDLCALL SDL_GetJoystickHat(SDL_Joystick *joystick, int hat);
975
976/**
977 * Get the current state of a button on a joystick.
978 *
979 * \param joystick an SDL_Joystick structure containing joystick information
980 * \param button the button index to get the state from; indices start at
981 * index 0
982 * \returns 1 if the specified button is pressed, 0 otherwise.
983 *
984 * \since This function is available since SDL 3.0.0.
985 *
986 * \sa SDL_GetNumJoystickButtons
987 */
988extern DECLSPEC Uint8 SDLCALL SDL_GetJoystickButton(SDL_Joystick *joystick, int button);
989
990/**
991 * Start a rumble effect.
992 *
993 * Each call to this function cancels any previous rumble effect, and calling
994 * it with 0 intensity stops any rumbling.
995 *
996 * This function requires you to process SDL events or call
997 * SDL_UpdateJoysticks() to update rumble state.
998 *
999 * \param joystick The joystick to vibrate
1000 * \param low_frequency_rumble The intensity of the low frequency (left)
1001 * rumble motor, from 0 to 0xFFFF
1002 * \param high_frequency_rumble The intensity of the high frequency (right)
1003 * rumble motor, from 0 to 0xFFFF
1004 * \param duration_ms The duration of the rumble effect, in milliseconds
1005 * \returns 0, or -1 if rumble isn't supported on this joystick
1006 *
1007 * \since This function is available since SDL 3.0.0.
1008 */
1009extern DECLSPEC int SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms);
1010
1011/**
1012 * Start a rumble effect in the joystick's triggers
1013 *
1014 * Each call to this function cancels any previous trigger rumble effect, and
1015 * calling it with 0 intensity stops any rumbling.
1016 *
1017 * Note that this is rumbling of the _triggers_ and not the game controller as
1018 * a whole. This is currently only supported on Xbox One controllers. If you
1019 * want the (more common) whole-controller rumble, use SDL_RumbleJoystick()
1020 * instead.
1021 *
1022 * This function requires you to process SDL events or call
1023 * SDL_UpdateJoysticks() to update rumble state.
1024 *
1025 * \param joystick The joystick to vibrate
1026 * \param left_rumble The intensity of the left trigger rumble motor, from 0
1027 * to 0xFFFF
1028 * \param right_rumble The intensity of the right trigger rumble motor, from 0
1029 * to 0xFFFF
1030 * \param duration_ms The duration of the rumble effect, in milliseconds
1031 * \returns 0 on success or a negative error code on failure; call
1032 * SDL_GetError() for more information.
1033 *
1034 * \since This function is available since SDL 3.0.0.
1035 *
1036 * \sa SDL_RumbleJoystick
1037 */
1038extern DECLSPEC int SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms);
1039
1040/**
1041 * Update a joystick's LED color.
1042 *
1043 * An example of a joystick LED is the light on the back of a PlayStation 4's
1044 * DualShock 4 controller.
1045 *
1046 * For joysticks with a single color LED, the maximum of the RGB values will
1047 * be used as the LED brightness.
1048 *
1049 * \param joystick The joystick to update
1050 * \param red The intensity of the red LED
1051 * \param green The intensity of the green LED
1052 * \param blue The intensity of the blue LED
1053 * \returns 0 on success or a negative error code on failure; call
1054 * SDL_GetError() for more information.
1055 *
1056 * \since This function is available since SDL 3.0.0.
1057 */
1058extern DECLSPEC int SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue);
1059
1060/**
1061 * Send a joystick specific effect packet
1062 *
1063 * \param joystick The joystick to affect
1064 * \param data The data to send to the joystick
1065 * \param size The size of the data to send to the joystick
1066 * \returns 0 on success or a negative error code on failure; call
1067 * SDL_GetError() for more information.
1068 *
1069 * \since This function is available since SDL 3.0.0.
1070 */
1071extern DECLSPEC int SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size);
1072
1073/**
1074 * Close a joystick previously opened with SDL_OpenJoystick().
1075 *
1076 * \param joystick The joystick device to close
1077 *
1078 * \since This function is available since SDL 3.0.0.
1079 *
1080 * \sa SDL_OpenJoystick
1081 */
1082extern DECLSPEC void SDLCALL SDL_CloseJoystick(SDL_Joystick *joystick);
1083
1084/**
1085 * Get the battery level of a joystick as SDL_JoystickPowerLevel.
1086 *
1087 * \param joystick the SDL_Joystick to query
1088 * \returns the current battery level as SDL_JoystickPowerLevel on success or
1089 * `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown
1090 *
1091 * \since This function is available since SDL 3.0.0.
1092 */
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_joystick_h_ */
int SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value)
SDL_JoystickType
@ SDL_JOYSTICK_TYPE_DANCE_PAD
@ SDL_JOYSTICK_TYPE_GAMEPAD
@ SDL_JOYSTICK_TYPE_ARCADE_PAD
@ SDL_JOYSTICK_TYPE_UNKNOWN
@ SDL_JOYSTICK_TYPE_ARCADE_STICK
@ SDL_JOYSTICK_TYPE_WHEEL
@ SDL_JOYSTICK_TYPE_THROTTLE
@ SDL_JOYSTICK_TYPE_GUITAR
@ SDL_JOYSTICK_TYPE_FLIGHT_STICK
@ SDL_JOYSTICK_TYPE_DRUM_KIT
void SDL_UnlockJoysticks(void) SDL_RELEASE(SDL_joystick_lock)
SDL_Joystick * SDL_OpenJoystick(SDL_JoystickID instance_id)
void SDL_UpdateJoysticks(void)
int SDL_GetJoystickInstancePlayerIndex(SDL_JoystickID instance_id)
Uint32 SDL_JoystickID
Uint8 SDL_GetJoystickButton(SDL_Joystick *joystick, int button)
Uint16 SDL_GetJoystickInstanceProduct(SDL_JoystickID instance_id)
const char * SDL_GetJoystickInstanceName(SDL_JoystickID instance_id)
Uint16 SDL_GetJoystickVendor(SDL_Joystick *joystick)
SDL_JoystickPowerLevel
@ SDL_JOYSTICK_POWER_MAX
@ SDL_JOYSTICK_POWER_FULL
@ SDL_JOYSTICK_POWER_MEDIUM
@ SDL_JOYSTICK_POWER_EMPTY
@ SDL_JOYSTICK_POWER_UNKNOWN
@ SDL_JOYSTICK_POWER_WIRED
@ SDL_JOYSTICK_POWER_LOW
const char * SDL_GetJoystickInstancePath(SDL_JoystickID instance_id)
SDL_JoystickGUID SDL_GetJoystickGUID(SDL_Joystick *joystick)
SDL_JoystickID * SDL_GetJoysticks(int *count)
SDL_JoystickID SDL_AttachVirtualJoystickEx(const SDL_VirtualJoystickDesc *desc)
int SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value)
SDL_JoystickPowerLevel SDL_GetJoystickPowerLevel(SDL_Joystick *joystick)
Uint16 SDL_GetJoystickProductVersion(SDL_Joystick *joystick)
SDL_Joystick * SDL_GetJoystickFromInstanceID(SDL_JoystickID instance_id)
const char * SDL_GetJoystickPath(SDL_Joystick *joystick)
int SDL_DetachVirtualJoystick(SDL_JoystickID instance_id)
SDL_bool SDL_IsJoystickVirtual(SDL_JoystickID instance_id)
int SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue)
void SDL_SetJoystickEventsEnabled(SDL_bool enabled)
SDL_JoystickType SDL_GetJoystickInstanceType(SDL_JoystickID instance_id)
int SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value)
struct SDL_Joystick SDL_Joystick
int SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms)
int SDL_GetNumJoystickHats(SDL_Joystick *joystick)
SDL_PropertiesID SDL_GetJoystickProperties(SDL_Joystick *joystick)
int SDL_GetJoystickBall(SDL_Joystick *joystick, int ball, int *dx, int *dy)
Uint16 SDL_GetJoystickProduct(SDL_Joystick *joystick)
SDL_JoystickType SDL_GetJoystickType(SDL_Joystick *joystick)
SDL_bool SDL_JoystickEventsEnabled(void)
int SDL_GetNumJoystickBalls(SDL_Joystick *joystick)
SDL_JoystickGUID SDL_GetJoystickGUIDFromString(const char *pchGUID)
SDL_GUID SDL_JoystickGUID
Uint16 SDL_GetJoystickInstanceVendor(SDL_JoystickID instance_id)
int SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms)
int SDL_GetNumJoystickButtons(SDL_Joystick *joystick)
int SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size)
void SDL_CloseJoystick(SDL_Joystick *joystick)
int SDL_GetNumJoystickAxes(SDL_Joystick *joystick)
SDL_JoystickGUID SDL_GetJoystickInstanceGUID(SDL_JoystickID instance_id)
void SDL_LockJoysticks(void) SDL_ACQUIRE(SDL_joystick_lock)
SDL_JoystickID SDL_AttachVirtualJoystick(SDL_JoystickType type, int naxes, int nbuttons, int nhats)
void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version, Uint16 *crc16)
int SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index)
Uint16 SDL_GetJoystickInstanceProductVersion(SDL_JoystickID instance_id)
const char * SDL_GetJoystickSerial(SDL_Joystick *joystick)
SDL_bool SDL_GetJoystickAxisInitialState(SDL_Joystick *joystick, int axis, Sint16 *state)
Uint8 SDL_GetJoystickHat(SDL_Joystick *joystick, int hat)
SDL_bool SDL_JoystickConnected(SDL_Joystick *joystick)
Uint16 SDL_GetJoystickFirmwareVersion(SDL_Joystick *joystick)
Sint16 SDL_GetJoystickAxis(SDL_Joystick *joystick, int axis)
int SDL_GetJoystickPlayerIndex(SDL_Joystick *joystick)
SDL_bool SDL_HasJoystick(void)
SDL_JoystickID SDL_GetJoystickInstanceID(SDL_Joystick *joystick)
const char * SDL_GetJoystickName(SDL_Joystick *joystick)
SDL_Joystick * SDL_GetJoystickFromPlayerIndex(int player_index)
int SDL_GetJoystickGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID)
#define SDL_ACQUIRE(x)
Definition SDL_mutex.h:73
struct SDL_Mutex SDL_Mutex
Definition SDL_mutex.h:132
#define SDL_RELEASE(x)
Definition SDL_mutex.h:79
Uint32 SDL_PropertiesID
uint8_t Uint8
Definition SDL_stdinc.h:150
uint16_t Uint16
Definition SDL_stdinc.h:162
SDL_MALLOC size_t size
Definition SDL_stdinc.h:410
int SDL_bool
Definition SDL_stdinc.h:137
int16_t Sint16
Definition SDL_stdinc.h:156
uint32_t Uint32
Definition SDL_stdinc.h:174
void(* SetPlayerIndex)(void *userdata, int player_index)
int(* SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue)
void(* Update)(void *userdata)
int(* SendEffect)(void *userdata, const void *data, int size)
int(* RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble)
int(* Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble)