sdl3_sys/generated/
gamepad.rs

1//! SDL provides a low-level joystick API, which just treats joysticks as an
2//! arbitrary pile of buttons, axes, and hat switches. If you're planning to
3//! write your own control configuration screen, this can give you a lot of
4//! flexibility, but that's a lot of work, and most things that we consider
5//! "joysticks" now are actually console-style gamepads. So SDL provides the
6//! gamepad API on top of the lower-level joystick functionality.
7//!
8//! The difference between a joystick and a gamepad is that a gamepad tells you
9//! _where_ a button or axis is on the device. You don't speak to gamepads in
10//! terms of arbitrary numbers like "button 3" or "axis 2" but in standard
11//! locations: the d-pad, the shoulder buttons, triggers, A/B/X/Y (or
12//! X/O/Square/Triangle, if you will).
13//!
14//! One turns a joystick into a gamepad by providing a magic configuration
15//! string, which tells SDL the details of a specific device: when you see this
16//! specific hardware, if button 2 gets pressed, this is actually D-Pad Up,
17//! etc.
18//!
19//! SDL has many popular controllers configured out of the box, and users can
20//! add their own controller details through an environment variable if it's
21//! otherwise unknown to SDL.
22//!
23//! In order to use these functions, [`SDL_Init()`] must have been called with the
24//! [`SDL_INIT_GAMEPAD`] flag. This causes SDL to scan the system for gamepads, and
25//! load appropriate drivers.
26//!
27//! If you're using SDL gamepad support in a Steam game, you must call
28//! SteamAPI_InitEx() before calling [`SDL_Init()`].
29//!
30//! If you would like to receive gamepad updates while the application is in
31//! the background, you should set the following hint before calling
32//! [`SDL_Init()`]\: [`SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS`]
33//!
34//! Gamepads support various optional features such as rumble, color LEDs,
35//! touchpad, gyro, etc. The support for these features varies depending on the
36//! controller and OS support available. You can check for LED and rumble
37//! capabilities at runtime by calling [`SDL_GetGamepadProperties()`] and checking
38//! the various capability properties. You can check for touchpad by calling
39//! [`SDL_GetNumGamepadTouchpads()`] and check for gyro and accelerometer by
40//! calling [`SDL_GamepadHasSensor()`].
41//!
42//! By default SDL will try to use the most capable driver available, but you
43//! can tune which OS drivers to use with the various joystick hints in
44//! SDL_hints.h.
45//!
46//! Your application should always support gamepad hotplugging. On some
47//! platforms like Xbox, Steam Deck, etc., this is a requirement for
48//! certification. On other platforms, like macOS and Windows when using
49//! Windows.Gaming.Input, controllers may not be available at startup and will
50//! come in at some point after you've started processing events.
51
52use super::stdinc::*;
53
54use super::error::*;
55
56use super::guid::*;
57
58use super::iostream::*;
59
60use super::joystick::*;
61
62use super::power::*;
63
64use super::properties::*;
65
66use super::sensor::*;
67
68/// Standard gamepad types.
69///
70/// This type does not necessarily map to first-party controllers from
71/// Microsoft/Sony/Nintendo; in many cases, third-party controllers can report
72/// as these, either because they were designed for a specific console, or they
73/// simply most closely match that console's controllers (does it have A/B/X/Y
74/// buttons or X/O/Square/Triangle? Does it have a touchpad? etc).
75///
76/// ## Known values (`sdl3-sys`)
77/// | Associated constant | Global constant | Description |
78/// | ------------------- | --------------- | ----------- |
79/// | [`UNKNOWN`](SDL_GamepadType::UNKNOWN) | [`SDL_GAMEPAD_TYPE_UNKNOWN`] | |
80/// | [`STANDARD`](SDL_GamepadType::STANDARD) | [`SDL_GAMEPAD_TYPE_STANDARD`] | |
81/// | [`XBOX360`](SDL_GamepadType::XBOX360) | [`SDL_GAMEPAD_TYPE_XBOX360`] | |
82/// | [`XBOXONE`](SDL_GamepadType::XBOXONE) | [`SDL_GAMEPAD_TYPE_XBOXONE`] | |
83/// | [`PS3`](SDL_GamepadType::PS3) | [`SDL_GAMEPAD_TYPE_PS3`] | |
84/// | [`PS4`](SDL_GamepadType::PS4) | [`SDL_GAMEPAD_TYPE_PS4`] | |
85/// | [`PS5`](SDL_GamepadType::PS5) | [`SDL_GAMEPAD_TYPE_PS5`] | |
86/// | [`NINTENDO_SWITCH_PRO`](SDL_GamepadType::NINTENDO_SWITCH_PRO) | [`SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO`] | |
87/// | [`NINTENDO_SWITCH_JOYCON_LEFT`](SDL_GamepadType::NINTENDO_SWITCH_JOYCON_LEFT) | [`SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT`] | |
88/// | [`NINTENDO_SWITCH_JOYCON_RIGHT`](SDL_GamepadType::NINTENDO_SWITCH_JOYCON_RIGHT) | [`SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT`] | |
89/// | [`NINTENDO_SWITCH_JOYCON_PAIR`](SDL_GamepadType::NINTENDO_SWITCH_JOYCON_PAIR) | [`SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR`] | |
90/// | [`GAMECUBE`](SDL_GamepadType::GAMECUBE) | [`SDL_GAMEPAD_TYPE_GAMECUBE`] | |
91/// | [`COUNT`](SDL_GamepadType::COUNT) | [`SDL_GAMEPAD_TYPE_COUNT`] | |
92#[repr(transparent)]
93#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
94pub struct SDL_GamepadType(pub ::core::ffi::c_int);
95
96impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GamepadType {
97    #[inline(always)]
98    fn eq(&self, other: &::core::ffi::c_int) -> bool {
99        &self.0 == other
100    }
101}
102
103impl ::core::cmp::PartialEq<SDL_GamepadType> for ::core::ffi::c_int {
104    #[inline(always)]
105    fn eq(&self, other: &SDL_GamepadType) -> bool {
106        self == &other.0
107    }
108}
109
110impl From<SDL_GamepadType> for ::core::ffi::c_int {
111    #[inline(always)]
112    fn from(value: SDL_GamepadType) -> Self {
113        value.0
114    }
115}
116
117#[cfg(feature = "debug-impls")]
118impl ::core::fmt::Debug for SDL_GamepadType {
119    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
120        #[allow(unreachable_patterns)]
121        f.write_str(match *self {
122            Self::UNKNOWN => "SDL_GAMEPAD_TYPE_UNKNOWN",
123            Self::STANDARD => "SDL_GAMEPAD_TYPE_STANDARD",
124            Self::XBOX360 => "SDL_GAMEPAD_TYPE_XBOX360",
125            Self::XBOXONE => "SDL_GAMEPAD_TYPE_XBOXONE",
126            Self::PS3 => "SDL_GAMEPAD_TYPE_PS3",
127            Self::PS4 => "SDL_GAMEPAD_TYPE_PS4",
128            Self::PS5 => "SDL_GAMEPAD_TYPE_PS5",
129            Self::NINTENDO_SWITCH_PRO => "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO",
130            Self::NINTENDO_SWITCH_JOYCON_LEFT => "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT",
131            Self::NINTENDO_SWITCH_JOYCON_RIGHT => "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT",
132            Self::NINTENDO_SWITCH_JOYCON_PAIR => "SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR",
133            Self::GAMECUBE => "SDL_GAMEPAD_TYPE_GAMECUBE",
134            Self::COUNT => "SDL_GAMEPAD_TYPE_COUNT",
135
136            _ => return write!(f, "SDL_GamepadType({})", self.0),
137        })
138    }
139}
140
141impl SDL_GamepadType {
142    pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int));
143    pub const STANDARD: Self = Self((1 as ::core::ffi::c_int));
144    pub const XBOX360: Self = Self((2 as ::core::ffi::c_int));
145    pub const XBOXONE: Self = Self((3 as ::core::ffi::c_int));
146    pub const PS3: Self = Self((4 as ::core::ffi::c_int));
147    pub const PS4: Self = Self((5 as ::core::ffi::c_int));
148    pub const PS5: Self = Self((6 as ::core::ffi::c_int));
149    pub const NINTENDO_SWITCH_PRO: Self = Self((7 as ::core::ffi::c_int));
150    pub const NINTENDO_SWITCH_JOYCON_LEFT: Self = Self((8 as ::core::ffi::c_int));
151    pub const NINTENDO_SWITCH_JOYCON_RIGHT: Self = Self((9 as ::core::ffi::c_int));
152    pub const NINTENDO_SWITCH_JOYCON_PAIR: Self = Self((10 as ::core::ffi::c_int));
153    pub const GAMECUBE: Self = Self((11 as ::core::ffi::c_int));
154    pub const COUNT: Self = Self((12 as ::core::ffi::c_int));
155}
156
157pub const SDL_GAMEPAD_TYPE_UNKNOWN: SDL_GamepadType = SDL_GamepadType::UNKNOWN;
158pub const SDL_GAMEPAD_TYPE_STANDARD: SDL_GamepadType = SDL_GamepadType::STANDARD;
159pub const SDL_GAMEPAD_TYPE_XBOX360: SDL_GamepadType = SDL_GamepadType::XBOX360;
160pub const SDL_GAMEPAD_TYPE_XBOXONE: SDL_GamepadType = SDL_GamepadType::XBOXONE;
161pub const SDL_GAMEPAD_TYPE_PS3: SDL_GamepadType = SDL_GamepadType::PS3;
162pub const SDL_GAMEPAD_TYPE_PS4: SDL_GamepadType = SDL_GamepadType::PS4;
163pub const SDL_GAMEPAD_TYPE_PS5: SDL_GamepadType = SDL_GamepadType::PS5;
164pub const SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO: SDL_GamepadType =
165    SDL_GamepadType::NINTENDO_SWITCH_PRO;
166pub const SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT: SDL_GamepadType =
167    SDL_GamepadType::NINTENDO_SWITCH_JOYCON_LEFT;
168pub const SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT: SDL_GamepadType =
169    SDL_GamepadType::NINTENDO_SWITCH_JOYCON_RIGHT;
170pub const SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR: SDL_GamepadType =
171    SDL_GamepadType::NINTENDO_SWITCH_JOYCON_PAIR;
172pub const SDL_GAMEPAD_TYPE_GAMECUBE: SDL_GamepadType = SDL_GamepadType::GAMECUBE;
173pub const SDL_GAMEPAD_TYPE_COUNT: SDL_GamepadType = SDL_GamepadType::COUNT;
174
175#[cfg(feature = "metadata")]
176impl sdl3_sys::metadata::GroupMetadata for SDL_GamepadType {
177    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
178        &crate::metadata::gamepad::METADATA_SDL_GamepadType;
179}
180
181/// The list of buttons available on a gamepad
182///
183/// For controllers that use a diamond pattern for the face buttons, the
184/// south/east/west/north buttons below correspond to the locations in the
185/// diamond pattern. For Xbox controllers, this would be A/B/X/Y, for Nintendo
186/// Switch controllers, this would be B/A/Y/X, for GameCube controllers this
187/// would be A/X/B/Y, for PlayStation controllers this would be
188/// Cross/Circle/Square/Triangle.
189///
190/// For controllers that don't use a diamond pattern for the face buttons, the
191/// south/east/west/north buttons indicate the buttons labeled A, B, C, D, or
192/// 1, 2, 3, 4, or for controllers that aren't labeled, they are the primary,
193/// secondary, etc. buttons.
194///
195/// The activate action is often the south button and the cancel action is
196/// often the east button, but in some regions this is reversed, so your game
197/// should allow remapping actions based on user preferences.
198///
199/// You can query the labels for the face buttons using
200/// [`SDL_GetGamepadButtonLabel()`]
201///
202/// ## Availability
203/// This enum is available since SDL 3.2.0.
204///
205/// ## Known values (`sdl3-sys`)
206/// | Associated constant | Global constant | Description |
207/// | ------------------- | --------------- | ----------- |
208/// | [`INVALID`](SDL_GamepadButton::INVALID) | [`SDL_GAMEPAD_BUTTON_INVALID`] | |
209/// | [`SOUTH`](SDL_GamepadButton::SOUTH) | [`SDL_GAMEPAD_BUTTON_SOUTH`] | Bottom face button (e.g. Xbox A button) |
210/// | [`EAST`](SDL_GamepadButton::EAST) | [`SDL_GAMEPAD_BUTTON_EAST`] | Right face button (e.g. Xbox B button) |
211/// | [`WEST`](SDL_GamepadButton::WEST) | [`SDL_GAMEPAD_BUTTON_WEST`] | Left face button (e.g. Xbox X button) |
212/// | [`NORTH`](SDL_GamepadButton::NORTH) | [`SDL_GAMEPAD_BUTTON_NORTH`] | Top face button (e.g. Xbox Y button) |
213/// | [`BACK`](SDL_GamepadButton::BACK) | [`SDL_GAMEPAD_BUTTON_BACK`] | |
214/// | [`GUIDE`](SDL_GamepadButton::GUIDE) | [`SDL_GAMEPAD_BUTTON_GUIDE`] | |
215/// | [`START`](SDL_GamepadButton::START) | [`SDL_GAMEPAD_BUTTON_START`] | |
216/// | [`LEFT_STICK`](SDL_GamepadButton::LEFT_STICK) | [`SDL_GAMEPAD_BUTTON_LEFT_STICK`] | |
217/// | [`RIGHT_STICK`](SDL_GamepadButton::RIGHT_STICK) | [`SDL_GAMEPAD_BUTTON_RIGHT_STICK`] | |
218/// | [`LEFT_SHOULDER`](SDL_GamepadButton::LEFT_SHOULDER) | [`SDL_GAMEPAD_BUTTON_LEFT_SHOULDER`] | |
219/// | [`RIGHT_SHOULDER`](SDL_GamepadButton::RIGHT_SHOULDER) | [`SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER`] | |
220/// | [`DPAD_UP`](SDL_GamepadButton::DPAD_UP) | [`SDL_GAMEPAD_BUTTON_DPAD_UP`] | |
221/// | [`DPAD_DOWN`](SDL_GamepadButton::DPAD_DOWN) | [`SDL_GAMEPAD_BUTTON_DPAD_DOWN`] | |
222/// | [`DPAD_LEFT`](SDL_GamepadButton::DPAD_LEFT) | [`SDL_GAMEPAD_BUTTON_DPAD_LEFT`] | |
223/// | [`DPAD_RIGHT`](SDL_GamepadButton::DPAD_RIGHT) | [`SDL_GAMEPAD_BUTTON_DPAD_RIGHT`] | |
224/// | [`MISC1`](SDL_GamepadButton::MISC1) | [`SDL_GAMEPAD_BUTTON_MISC1`] | Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button) |
225/// | [`RIGHT_PADDLE1`](SDL_GamepadButton::RIGHT_PADDLE1) | [`SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1`] | Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button) |
226/// | [`LEFT_PADDLE1`](SDL_GamepadButton::LEFT_PADDLE1) | [`SDL_GAMEPAD_BUTTON_LEFT_PADDLE1`] | Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button) |
227/// | [`RIGHT_PADDLE2`](SDL_GamepadButton::RIGHT_PADDLE2) | [`SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2`] | Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button) |
228/// | [`LEFT_PADDLE2`](SDL_GamepadButton::LEFT_PADDLE2) | [`SDL_GAMEPAD_BUTTON_LEFT_PADDLE2`] | Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button) |
229/// | [`TOUCHPAD`](SDL_GamepadButton::TOUCHPAD) | [`SDL_GAMEPAD_BUTTON_TOUCHPAD`] | PS4/PS5 touchpad button |
230/// | [`MISC2`](SDL_GamepadButton::MISC2) | [`SDL_GAMEPAD_BUTTON_MISC2`] | Additional button |
231/// | [`MISC3`](SDL_GamepadButton::MISC3) | [`SDL_GAMEPAD_BUTTON_MISC3`] | Additional button (e.g. Nintendo GameCube left trigger click) |
232/// | [`MISC4`](SDL_GamepadButton::MISC4) | [`SDL_GAMEPAD_BUTTON_MISC4`] | Additional button (e.g. Nintendo GameCube right trigger click) |
233/// | [`MISC5`](SDL_GamepadButton::MISC5) | [`SDL_GAMEPAD_BUTTON_MISC5`] | Additional button |
234/// | [`MISC6`](SDL_GamepadButton::MISC6) | [`SDL_GAMEPAD_BUTTON_MISC6`] | Additional button |
235/// | [`COUNT`](SDL_GamepadButton::COUNT) | [`SDL_GAMEPAD_BUTTON_COUNT`] | |
236#[repr(transparent)]
237#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
238pub struct SDL_GamepadButton(pub ::core::ffi::c_int);
239
240impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GamepadButton {
241    #[inline(always)]
242    fn eq(&self, other: &::core::ffi::c_int) -> bool {
243        &self.0 == other
244    }
245}
246
247impl ::core::cmp::PartialEq<SDL_GamepadButton> for ::core::ffi::c_int {
248    #[inline(always)]
249    fn eq(&self, other: &SDL_GamepadButton) -> bool {
250        self == &other.0
251    }
252}
253
254impl From<SDL_GamepadButton> for ::core::ffi::c_int {
255    #[inline(always)]
256    fn from(value: SDL_GamepadButton) -> Self {
257        value.0
258    }
259}
260
261#[cfg(feature = "debug-impls")]
262impl ::core::fmt::Debug for SDL_GamepadButton {
263    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
264        #[allow(unreachable_patterns)]
265        f.write_str(match *self {
266            Self::INVALID => "SDL_GAMEPAD_BUTTON_INVALID",
267            Self::SOUTH => "SDL_GAMEPAD_BUTTON_SOUTH",
268            Self::EAST => "SDL_GAMEPAD_BUTTON_EAST",
269            Self::WEST => "SDL_GAMEPAD_BUTTON_WEST",
270            Self::NORTH => "SDL_GAMEPAD_BUTTON_NORTH",
271            Self::BACK => "SDL_GAMEPAD_BUTTON_BACK",
272            Self::GUIDE => "SDL_GAMEPAD_BUTTON_GUIDE",
273            Self::START => "SDL_GAMEPAD_BUTTON_START",
274            Self::LEFT_STICK => "SDL_GAMEPAD_BUTTON_LEFT_STICK",
275            Self::RIGHT_STICK => "SDL_GAMEPAD_BUTTON_RIGHT_STICK",
276            Self::LEFT_SHOULDER => "SDL_GAMEPAD_BUTTON_LEFT_SHOULDER",
277            Self::RIGHT_SHOULDER => "SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER",
278            Self::DPAD_UP => "SDL_GAMEPAD_BUTTON_DPAD_UP",
279            Self::DPAD_DOWN => "SDL_GAMEPAD_BUTTON_DPAD_DOWN",
280            Self::DPAD_LEFT => "SDL_GAMEPAD_BUTTON_DPAD_LEFT",
281            Self::DPAD_RIGHT => "SDL_GAMEPAD_BUTTON_DPAD_RIGHT",
282            Self::MISC1 => "SDL_GAMEPAD_BUTTON_MISC1",
283            Self::RIGHT_PADDLE1 => "SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1",
284            Self::LEFT_PADDLE1 => "SDL_GAMEPAD_BUTTON_LEFT_PADDLE1",
285            Self::RIGHT_PADDLE2 => "SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2",
286            Self::LEFT_PADDLE2 => "SDL_GAMEPAD_BUTTON_LEFT_PADDLE2",
287            Self::TOUCHPAD => "SDL_GAMEPAD_BUTTON_TOUCHPAD",
288            Self::MISC2 => "SDL_GAMEPAD_BUTTON_MISC2",
289            Self::MISC3 => "SDL_GAMEPAD_BUTTON_MISC3",
290            Self::MISC4 => "SDL_GAMEPAD_BUTTON_MISC4",
291            Self::MISC5 => "SDL_GAMEPAD_BUTTON_MISC5",
292            Self::MISC6 => "SDL_GAMEPAD_BUTTON_MISC6",
293            Self::COUNT => "SDL_GAMEPAD_BUTTON_COUNT",
294
295            _ => return write!(f, "SDL_GamepadButton({})", self.0),
296        })
297    }
298}
299
300impl SDL_GamepadButton {
301    pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int));
302    /// Bottom face button (e.g. Xbox A button)
303    pub const SOUTH: Self = Self((0_i32 as ::core::ffi::c_int));
304    /// Right face button (e.g. Xbox B button)
305    pub const EAST: Self = Self((1_i32 as ::core::ffi::c_int));
306    /// Left face button (e.g. Xbox X button)
307    pub const WEST: Self = Self((2_i32 as ::core::ffi::c_int));
308    /// Top face button (e.g. Xbox Y button)
309    pub const NORTH: Self = Self((3_i32 as ::core::ffi::c_int));
310    pub const BACK: Self = Self((4_i32 as ::core::ffi::c_int));
311    pub const GUIDE: Self = Self((5_i32 as ::core::ffi::c_int));
312    pub const START: Self = Self((6_i32 as ::core::ffi::c_int));
313    pub const LEFT_STICK: Self = Self((7_i32 as ::core::ffi::c_int));
314    pub const RIGHT_STICK: Self = Self((8_i32 as ::core::ffi::c_int));
315    pub const LEFT_SHOULDER: Self = Self((9_i32 as ::core::ffi::c_int));
316    pub const RIGHT_SHOULDER: Self = Self((10_i32 as ::core::ffi::c_int));
317    pub const DPAD_UP: Self = Self((11_i32 as ::core::ffi::c_int));
318    pub const DPAD_DOWN: Self = Self((12_i32 as ::core::ffi::c_int));
319    pub const DPAD_LEFT: Self = Self((13_i32 as ::core::ffi::c_int));
320    pub const DPAD_RIGHT: Self = Self((14_i32 as ::core::ffi::c_int));
321    /// Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button)
322    pub const MISC1: Self = Self((15_i32 as ::core::ffi::c_int));
323    /// Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button)
324    pub const RIGHT_PADDLE1: Self = Self((16_i32 as ::core::ffi::c_int));
325    /// Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button)
326    pub const LEFT_PADDLE1: Self = Self((17_i32 as ::core::ffi::c_int));
327    /// Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button)
328    pub const RIGHT_PADDLE2: Self = Self((18_i32 as ::core::ffi::c_int));
329    /// Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button)
330    pub const LEFT_PADDLE2: Self = Self((19_i32 as ::core::ffi::c_int));
331    /// PS4/PS5 touchpad button
332    pub const TOUCHPAD: Self = Self((20_i32 as ::core::ffi::c_int));
333    /// Additional button
334    pub const MISC2: Self = Self((21_i32 as ::core::ffi::c_int));
335    /// Additional button (e.g. Nintendo GameCube left trigger click)
336    pub const MISC3: Self = Self((22_i32 as ::core::ffi::c_int));
337    /// Additional button (e.g. Nintendo GameCube right trigger click)
338    pub const MISC4: Self = Self((23_i32 as ::core::ffi::c_int));
339    /// Additional button
340    pub const MISC5: Self = Self((24_i32 as ::core::ffi::c_int));
341    /// Additional button
342    pub const MISC6: Self = Self((25_i32 as ::core::ffi::c_int));
343    pub const COUNT: Self = Self((26_i32 as ::core::ffi::c_int));
344}
345
346pub const SDL_GAMEPAD_BUTTON_INVALID: SDL_GamepadButton = SDL_GamepadButton::INVALID;
347/// Bottom face button (e.g. Xbox A button)
348pub const SDL_GAMEPAD_BUTTON_SOUTH: SDL_GamepadButton = SDL_GamepadButton::SOUTH;
349/// Right face button (e.g. Xbox B button)
350pub const SDL_GAMEPAD_BUTTON_EAST: SDL_GamepadButton = SDL_GamepadButton::EAST;
351/// Left face button (e.g. Xbox X button)
352pub const SDL_GAMEPAD_BUTTON_WEST: SDL_GamepadButton = SDL_GamepadButton::WEST;
353/// Top face button (e.g. Xbox Y button)
354pub const SDL_GAMEPAD_BUTTON_NORTH: SDL_GamepadButton = SDL_GamepadButton::NORTH;
355pub const SDL_GAMEPAD_BUTTON_BACK: SDL_GamepadButton = SDL_GamepadButton::BACK;
356pub const SDL_GAMEPAD_BUTTON_GUIDE: SDL_GamepadButton = SDL_GamepadButton::GUIDE;
357pub const SDL_GAMEPAD_BUTTON_START: SDL_GamepadButton = SDL_GamepadButton::START;
358pub const SDL_GAMEPAD_BUTTON_LEFT_STICK: SDL_GamepadButton = SDL_GamepadButton::LEFT_STICK;
359pub const SDL_GAMEPAD_BUTTON_RIGHT_STICK: SDL_GamepadButton = SDL_GamepadButton::RIGHT_STICK;
360pub const SDL_GAMEPAD_BUTTON_LEFT_SHOULDER: SDL_GamepadButton = SDL_GamepadButton::LEFT_SHOULDER;
361pub const SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER: SDL_GamepadButton = SDL_GamepadButton::RIGHT_SHOULDER;
362pub const SDL_GAMEPAD_BUTTON_DPAD_UP: SDL_GamepadButton = SDL_GamepadButton::DPAD_UP;
363pub const SDL_GAMEPAD_BUTTON_DPAD_DOWN: SDL_GamepadButton = SDL_GamepadButton::DPAD_DOWN;
364pub const SDL_GAMEPAD_BUTTON_DPAD_LEFT: SDL_GamepadButton = SDL_GamepadButton::DPAD_LEFT;
365pub const SDL_GAMEPAD_BUTTON_DPAD_RIGHT: SDL_GamepadButton = SDL_GamepadButton::DPAD_RIGHT;
366/// Additional button (e.g. Xbox Series X share button, PS5 microphone button, Nintendo Switch Pro capture button, Amazon Luna microphone button, Google Stadia capture button)
367pub const SDL_GAMEPAD_BUTTON_MISC1: SDL_GamepadButton = SDL_GamepadButton::MISC1;
368/// Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button)
369pub const SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1: SDL_GamepadButton = SDL_GamepadButton::RIGHT_PADDLE1;
370/// Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button)
371pub const SDL_GAMEPAD_BUTTON_LEFT_PADDLE1: SDL_GamepadButton = SDL_GamepadButton::LEFT_PADDLE1;
372/// Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button)
373pub const SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2: SDL_GamepadButton = SDL_GamepadButton::RIGHT_PADDLE2;
374/// Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button)
375pub const SDL_GAMEPAD_BUTTON_LEFT_PADDLE2: SDL_GamepadButton = SDL_GamepadButton::LEFT_PADDLE2;
376/// PS4/PS5 touchpad button
377pub const SDL_GAMEPAD_BUTTON_TOUCHPAD: SDL_GamepadButton = SDL_GamepadButton::TOUCHPAD;
378/// Additional button
379pub const SDL_GAMEPAD_BUTTON_MISC2: SDL_GamepadButton = SDL_GamepadButton::MISC2;
380/// Additional button (e.g. Nintendo GameCube left trigger click)
381pub const SDL_GAMEPAD_BUTTON_MISC3: SDL_GamepadButton = SDL_GamepadButton::MISC3;
382/// Additional button (e.g. Nintendo GameCube right trigger click)
383pub const SDL_GAMEPAD_BUTTON_MISC4: SDL_GamepadButton = SDL_GamepadButton::MISC4;
384/// Additional button
385pub const SDL_GAMEPAD_BUTTON_MISC5: SDL_GamepadButton = SDL_GamepadButton::MISC5;
386/// Additional button
387pub const SDL_GAMEPAD_BUTTON_MISC6: SDL_GamepadButton = SDL_GamepadButton::MISC6;
388pub const SDL_GAMEPAD_BUTTON_COUNT: SDL_GamepadButton = SDL_GamepadButton::COUNT;
389
390#[cfg(feature = "metadata")]
391impl sdl3_sys::metadata::GroupMetadata for SDL_GamepadButton {
392    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
393        &crate::metadata::gamepad::METADATA_SDL_GamepadButton;
394}
395
396/// The set of gamepad button labels
397///
398/// This isn't a complete set, just the face buttons to make it easy to show
399/// button prompts.
400///
401/// For a complete set, you should look at the button and gamepad type and have
402/// a set of symbols that work well with your art style.
403///
404/// ## Availability
405/// This enum is available since SDL 3.2.0.
406///
407/// ## Known values (`sdl3-sys`)
408/// | Associated constant | Global constant | Description |
409/// | ------------------- | --------------- | ----------- |
410/// | [`UNKNOWN`](SDL_GamepadButtonLabel::UNKNOWN) | [`SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN`] | |
411/// | [`A`](SDL_GamepadButtonLabel::A) | [`SDL_GAMEPAD_BUTTON_LABEL_A`] | |
412/// | [`B`](SDL_GamepadButtonLabel::B) | [`SDL_GAMEPAD_BUTTON_LABEL_B`] | |
413/// | [`X`](SDL_GamepadButtonLabel::X) | [`SDL_GAMEPAD_BUTTON_LABEL_X`] | |
414/// | [`Y`](SDL_GamepadButtonLabel::Y) | [`SDL_GAMEPAD_BUTTON_LABEL_Y`] | |
415/// | [`CROSS`](SDL_GamepadButtonLabel::CROSS) | [`SDL_GAMEPAD_BUTTON_LABEL_CROSS`] | |
416/// | [`CIRCLE`](SDL_GamepadButtonLabel::CIRCLE) | [`SDL_GAMEPAD_BUTTON_LABEL_CIRCLE`] | |
417/// | [`SQUARE`](SDL_GamepadButtonLabel::SQUARE) | [`SDL_GAMEPAD_BUTTON_LABEL_SQUARE`] | |
418/// | [`TRIANGLE`](SDL_GamepadButtonLabel::TRIANGLE) | [`SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE`] | |
419#[repr(transparent)]
420#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
421pub struct SDL_GamepadButtonLabel(pub ::core::ffi::c_int);
422
423impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GamepadButtonLabel {
424    #[inline(always)]
425    fn eq(&self, other: &::core::ffi::c_int) -> bool {
426        &self.0 == other
427    }
428}
429
430impl ::core::cmp::PartialEq<SDL_GamepadButtonLabel> for ::core::ffi::c_int {
431    #[inline(always)]
432    fn eq(&self, other: &SDL_GamepadButtonLabel) -> bool {
433        self == &other.0
434    }
435}
436
437impl From<SDL_GamepadButtonLabel> for ::core::ffi::c_int {
438    #[inline(always)]
439    fn from(value: SDL_GamepadButtonLabel) -> Self {
440        value.0
441    }
442}
443
444#[cfg(feature = "debug-impls")]
445impl ::core::fmt::Debug for SDL_GamepadButtonLabel {
446    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
447        #[allow(unreachable_patterns)]
448        f.write_str(match *self {
449            Self::UNKNOWN => "SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN",
450            Self::A => "SDL_GAMEPAD_BUTTON_LABEL_A",
451            Self::B => "SDL_GAMEPAD_BUTTON_LABEL_B",
452            Self::X => "SDL_GAMEPAD_BUTTON_LABEL_X",
453            Self::Y => "SDL_GAMEPAD_BUTTON_LABEL_Y",
454            Self::CROSS => "SDL_GAMEPAD_BUTTON_LABEL_CROSS",
455            Self::CIRCLE => "SDL_GAMEPAD_BUTTON_LABEL_CIRCLE",
456            Self::SQUARE => "SDL_GAMEPAD_BUTTON_LABEL_SQUARE",
457            Self::TRIANGLE => "SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE",
458
459            _ => return write!(f, "SDL_GamepadButtonLabel({})", self.0),
460        })
461    }
462}
463
464impl SDL_GamepadButtonLabel {
465    pub const UNKNOWN: Self = Self((0 as ::core::ffi::c_int));
466    pub const A: Self = Self((1 as ::core::ffi::c_int));
467    pub const B: Self = Self((2 as ::core::ffi::c_int));
468    pub const X: Self = Self((3 as ::core::ffi::c_int));
469    pub const Y: Self = Self((4 as ::core::ffi::c_int));
470    pub const CROSS: Self = Self((5 as ::core::ffi::c_int));
471    pub const CIRCLE: Self = Self((6 as ::core::ffi::c_int));
472    pub const SQUARE: Self = Self((7 as ::core::ffi::c_int));
473    pub const TRIANGLE: Self = Self((8 as ::core::ffi::c_int));
474}
475
476pub const SDL_GAMEPAD_BUTTON_LABEL_UNKNOWN: SDL_GamepadButtonLabel =
477    SDL_GamepadButtonLabel::UNKNOWN;
478pub const SDL_GAMEPAD_BUTTON_LABEL_A: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::A;
479pub const SDL_GAMEPAD_BUTTON_LABEL_B: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::B;
480pub const SDL_GAMEPAD_BUTTON_LABEL_X: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::X;
481pub const SDL_GAMEPAD_BUTTON_LABEL_Y: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::Y;
482pub const SDL_GAMEPAD_BUTTON_LABEL_CROSS: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::CROSS;
483pub const SDL_GAMEPAD_BUTTON_LABEL_CIRCLE: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::CIRCLE;
484pub const SDL_GAMEPAD_BUTTON_LABEL_SQUARE: SDL_GamepadButtonLabel = SDL_GamepadButtonLabel::SQUARE;
485pub const SDL_GAMEPAD_BUTTON_LABEL_TRIANGLE: SDL_GamepadButtonLabel =
486    SDL_GamepadButtonLabel::TRIANGLE;
487
488#[cfg(feature = "metadata")]
489impl sdl3_sys::metadata::GroupMetadata for SDL_GamepadButtonLabel {
490    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
491        &crate::metadata::gamepad::METADATA_SDL_GamepadButtonLabel;
492}
493
494/// The list of axes available on a gamepad
495///
496/// Thumbstick axis values range from [`SDL_JOYSTICK_AXIS_MIN`] to
497/// [`SDL_JOYSTICK_AXIS_MAX`], and are centered within ~8000 of zero, though
498/// advanced UI will allow users to set or autodetect the dead zone, which
499/// varies between gamepads.
500///
501/// Trigger axis values range from 0 (released) to [`SDL_JOYSTICK_AXIS_MAX`] (fully
502/// pressed) when reported by [`SDL_GetGamepadAxis()`]. Note that this is not the
503/// same range that will be reported by the lower-level [`SDL_GetJoystickAxis()`].
504///
505/// ## Availability
506/// This enum is available since SDL 3.2.0.
507///
508/// ## Known values (`sdl3-sys`)
509/// | Associated constant | Global constant | Description |
510/// | ------------------- | --------------- | ----------- |
511/// | [`INVALID`](SDL_GamepadAxis::INVALID) | [`SDL_GAMEPAD_AXIS_INVALID`] | |
512/// | [`LEFTX`](SDL_GamepadAxis::LEFTX) | [`SDL_GAMEPAD_AXIS_LEFTX`] | |
513/// | [`LEFTY`](SDL_GamepadAxis::LEFTY) | [`SDL_GAMEPAD_AXIS_LEFTY`] | |
514/// | [`RIGHTX`](SDL_GamepadAxis::RIGHTX) | [`SDL_GAMEPAD_AXIS_RIGHTX`] | |
515/// | [`RIGHTY`](SDL_GamepadAxis::RIGHTY) | [`SDL_GAMEPAD_AXIS_RIGHTY`] | |
516/// | [`LEFT_TRIGGER`](SDL_GamepadAxis::LEFT_TRIGGER) | [`SDL_GAMEPAD_AXIS_LEFT_TRIGGER`] | |
517/// | [`RIGHT_TRIGGER`](SDL_GamepadAxis::RIGHT_TRIGGER) | [`SDL_GAMEPAD_AXIS_RIGHT_TRIGGER`] | |
518/// | [`COUNT`](SDL_GamepadAxis::COUNT) | [`SDL_GAMEPAD_AXIS_COUNT`] | |
519#[repr(transparent)]
520#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
521pub struct SDL_GamepadAxis(pub ::core::ffi::c_int);
522
523impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GamepadAxis {
524    #[inline(always)]
525    fn eq(&self, other: &::core::ffi::c_int) -> bool {
526        &self.0 == other
527    }
528}
529
530impl ::core::cmp::PartialEq<SDL_GamepadAxis> for ::core::ffi::c_int {
531    #[inline(always)]
532    fn eq(&self, other: &SDL_GamepadAxis) -> bool {
533        self == &other.0
534    }
535}
536
537impl From<SDL_GamepadAxis> for ::core::ffi::c_int {
538    #[inline(always)]
539    fn from(value: SDL_GamepadAxis) -> Self {
540        value.0
541    }
542}
543
544#[cfg(feature = "debug-impls")]
545impl ::core::fmt::Debug for SDL_GamepadAxis {
546    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
547        #[allow(unreachable_patterns)]
548        f.write_str(match *self {
549            Self::INVALID => "SDL_GAMEPAD_AXIS_INVALID",
550            Self::LEFTX => "SDL_GAMEPAD_AXIS_LEFTX",
551            Self::LEFTY => "SDL_GAMEPAD_AXIS_LEFTY",
552            Self::RIGHTX => "SDL_GAMEPAD_AXIS_RIGHTX",
553            Self::RIGHTY => "SDL_GAMEPAD_AXIS_RIGHTY",
554            Self::LEFT_TRIGGER => "SDL_GAMEPAD_AXIS_LEFT_TRIGGER",
555            Self::RIGHT_TRIGGER => "SDL_GAMEPAD_AXIS_RIGHT_TRIGGER",
556            Self::COUNT => "SDL_GAMEPAD_AXIS_COUNT",
557
558            _ => return write!(f, "SDL_GamepadAxis({})", self.0),
559        })
560    }
561}
562
563impl SDL_GamepadAxis {
564    pub const INVALID: Self = Self((-1_i32 as ::core::ffi::c_int));
565    pub const LEFTX: Self = Self((0_i32 as ::core::ffi::c_int));
566    pub const LEFTY: Self = Self((1_i32 as ::core::ffi::c_int));
567    pub const RIGHTX: Self = Self((2_i32 as ::core::ffi::c_int));
568    pub const RIGHTY: Self = Self((3_i32 as ::core::ffi::c_int));
569    pub const LEFT_TRIGGER: Self = Self((4_i32 as ::core::ffi::c_int));
570    pub const RIGHT_TRIGGER: Self = Self((5_i32 as ::core::ffi::c_int));
571    pub const COUNT: Self = Self((6_i32 as ::core::ffi::c_int));
572}
573
574pub const SDL_GAMEPAD_AXIS_INVALID: SDL_GamepadAxis = SDL_GamepadAxis::INVALID;
575pub const SDL_GAMEPAD_AXIS_LEFTX: SDL_GamepadAxis = SDL_GamepadAxis::LEFTX;
576pub const SDL_GAMEPAD_AXIS_LEFTY: SDL_GamepadAxis = SDL_GamepadAxis::LEFTY;
577pub const SDL_GAMEPAD_AXIS_RIGHTX: SDL_GamepadAxis = SDL_GamepadAxis::RIGHTX;
578pub const SDL_GAMEPAD_AXIS_RIGHTY: SDL_GamepadAxis = SDL_GamepadAxis::RIGHTY;
579pub const SDL_GAMEPAD_AXIS_LEFT_TRIGGER: SDL_GamepadAxis = SDL_GamepadAxis::LEFT_TRIGGER;
580pub const SDL_GAMEPAD_AXIS_RIGHT_TRIGGER: SDL_GamepadAxis = SDL_GamepadAxis::RIGHT_TRIGGER;
581pub const SDL_GAMEPAD_AXIS_COUNT: SDL_GamepadAxis = SDL_GamepadAxis::COUNT;
582
583#[cfg(feature = "metadata")]
584impl sdl3_sys::metadata::GroupMetadata for SDL_GamepadAxis {
585    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
586        &crate::metadata::gamepad::METADATA_SDL_GamepadAxis;
587}
588
589/// Types of gamepad control bindings.
590///
591/// A gamepad is a collection of bindings that map arbitrary joystick buttons,
592/// axes and hat switches to specific positions on a generic console-style
593/// gamepad. This enum is used as part of [`SDL_GamepadBinding`] to specify those
594/// mappings.
595///
596/// ## Availability
597/// This enum is available since SDL 3.2.0.
598///
599/// ## Known values (`sdl3-sys`)
600/// | Associated constant | Global constant | Description |
601/// | ------------------- | --------------- | ----------- |
602/// | [`NONE`](SDL_GamepadBindingType::NONE) | [`SDL_GAMEPAD_BINDTYPE_NONE`] | |
603/// | [`BUTTON`](SDL_GamepadBindingType::BUTTON) | [`SDL_GAMEPAD_BINDTYPE_BUTTON`] | |
604/// | [`AXIS`](SDL_GamepadBindingType::AXIS) | [`SDL_GAMEPAD_BINDTYPE_AXIS`] | |
605/// | [`HAT`](SDL_GamepadBindingType::HAT) | [`SDL_GAMEPAD_BINDTYPE_HAT`] | |
606#[repr(transparent)]
607#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
608pub struct SDL_GamepadBindingType(pub ::core::ffi::c_int);
609
610impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GamepadBindingType {
611    #[inline(always)]
612    fn eq(&self, other: &::core::ffi::c_int) -> bool {
613        &self.0 == other
614    }
615}
616
617impl ::core::cmp::PartialEq<SDL_GamepadBindingType> for ::core::ffi::c_int {
618    #[inline(always)]
619    fn eq(&self, other: &SDL_GamepadBindingType) -> bool {
620        self == &other.0
621    }
622}
623
624impl From<SDL_GamepadBindingType> for ::core::ffi::c_int {
625    #[inline(always)]
626    fn from(value: SDL_GamepadBindingType) -> Self {
627        value.0
628    }
629}
630
631#[cfg(feature = "debug-impls")]
632impl ::core::fmt::Debug for SDL_GamepadBindingType {
633    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
634        #[allow(unreachable_patterns)]
635        f.write_str(match *self {
636            Self::NONE => "SDL_GAMEPAD_BINDTYPE_NONE",
637            Self::BUTTON => "SDL_GAMEPAD_BINDTYPE_BUTTON",
638            Self::AXIS => "SDL_GAMEPAD_BINDTYPE_AXIS",
639            Self::HAT => "SDL_GAMEPAD_BINDTYPE_HAT",
640
641            _ => return write!(f, "SDL_GamepadBindingType({})", self.0),
642        })
643    }
644}
645
646impl SDL_GamepadBindingType {
647    pub const NONE: Self = Self((0 as ::core::ffi::c_int));
648    pub const BUTTON: Self = Self((1 as ::core::ffi::c_int));
649    pub const AXIS: Self = Self((2 as ::core::ffi::c_int));
650    pub const HAT: Self = Self((3 as ::core::ffi::c_int));
651}
652
653pub const SDL_GAMEPAD_BINDTYPE_NONE: SDL_GamepadBindingType = SDL_GamepadBindingType::NONE;
654pub const SDL_GAMEPAD_BINDTYPE_BUTTON: SDL_GamepadBindingType = SDL_GamepadBindingType::BUTTON;
655pub const SDL_GAMEPAD_BINDTYPE_AXIS: SDL_GamepadBindingType = SDL_GamepadBindingType::AXIS;
656pub const SDL_GAMEPAD_BINDTYPE_HAT: SDL_GamepadBindingType = SDL_GamepadBindingType::HAT;
657
658#[cfg(feature = "metadata")]
659impl sdl3_sys::metadata::GroupMetadata for SDL_GamepadBindingType {
660    const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
661        &crate::metadata::gamepad::METADATA_SDL_GamepadBindingType;
662}
663
664#[cfg(feature = "debug-impls")]
665impl ::core::fmt::Debug for SDL_GamepadBinding {
666    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
667        let mut s = f.debug_struct("SDL_GamepadBinding");
668        s.field("input_type", &self.input_type);
669        match self.input_type {
670            SDL_GamepadBindingType::BUTTON => {
671                s.field("input.button", unsafe { &self.input.button });
672            }
673            SDL_GamepadBindingType::AXIS => {
674                s.field("input.axis", unsafe { &self.input.axis });
675            }
676            SDL_GamepadBindingType::HAT => {
677                s.field("input.hat", unsafe { &self.input.hat });
678            }
679            _ => (),
680        }
681        s.field("output_type", &self.output_type);
682        match self.output_type {
683            SDL_GamepadBindingType::BUTTON => {
684                s.field("output.button", unsafe { &self.output.button });
685            }
686            SDL_GamepadBindingType::AXIS => {
687                s.field("output.axis", unsafe { &self.output.axis });
688            }
689            _ => (),
690        }
691        s.finish()
692    }
693}
694/// A mapping between one joystick input to a gamepad control.
695///
696/// A gamepad has a collection of several bindings, to say, for example, when
697/// joystick button number 5 is pressed, that should be treated like the
698/// gamepad's "start" button.
699///
700/// SDL has these bindings built-in for many popular controllers, and can add
701/// more with a simple text string. Those strings are parsed into a collection
702/// of these structs to make it easier to operate on the data.
703///
704/// ## Availability
705/// This struct is available since SDL 3.2.0.
706///
707/// ## See also
708/// - [`SDL_GetGamepadBindings`]
709#[repr(C)]
710#[derive(Clone, Copy)]
711pub struct SDL_GamepadBinding {
712    pub input_type: SDL_GamepadBindingType,
713    pub input: SDL_GamepadBinding__AnonUnion1,
714    pub output_type: SDL_GamepadBindingType,
715    pub output: SDL_GamepadBinding__AnonUnion2,
716}
717
718impl ::core::default::Default for SDL_GamepadBinding {
719    /// Initialize all fields to zero
720    #[inline(always)]
721    fn default() -> Self {
722        unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
723    }
724}
725
726#[repr(C)]
727#[derive(Clone, Copy)]
728pub union SDL_GamepadBinding__AnonUnion1 {
729    pub button: ::core::ffi::c_int,
730    pub axis: SDL_GamepadBinding__AnonUnion1__AnonStruct1,
731    pub hat: SDL_GamepadBinding__AnonUnion1__AnonStruct2,
732}
733
734impl ::core::default::Default for SDL_GamepadBinding__AnonUnion1 {
735    /// Initialize all fields to zero
736    #[inline(always)]
737    fn default() -> Self {
738        unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
739    }
740}
741
742#[repr(C)]
743#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
744#[cfg_attr(feature = "debug-impls", derive(Debug))]
745pub struct SDL_GamepadBinding__AnonUnion1__AnonStruct1 {
746    pub axis: ::core::ffi::c_int,
747    pub axis_min: ::core::ffi::c_int,
748    pub axis_max: ::core::ffi::c_int,
749}
750
751#[repr(C)]
752#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
753#[cfg_attr(feature = "debug-impls", derive(Debug))]
754pub struct SDL_GamepadBinding__AnonUnion1__AnonStruct2 {
755    pub hat: ::core::ffi::c_int,
756    pub hat_mask: ::core::ffi::c_int,
757}
758
759#[repr(C)]
760#[derive(Clone, Copy)]
761pub union SDL_GamepadBinding__AnonUnion2 {
762    pub button: SDL_GamepadButton,
763    pub axis: SDL_GamepadBinding__AnonUnion2__AnonStruct1,
764}
765
766impl ::core::default::Default for SDL_GamepadBinding__AnonUnion2 {
767    /// Initialize all fields to zero
768    #[inline(always)]
769    fn default() -> Self {
770        unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
771    }
772}
773
774#[repr(C)]
775#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
776#[cfg_attr(feature = "debug-impls", derive(Debug))]
777pub struct SDL_GamepadBinding__AnonUnion2__AnonStruct1 {
778    pub axis: SDL_GamepadAxis,
779    pub axis_min: ::core::ffi::c_int,
780    pub axis_max: ::core::ffi::c_int,
781}
782
783unsafe extern "C" {
784    /// Add support for gamepads that SDL is unaware of or change the binding of an
785    /// existing gamepad.
786    ///
787    /// The mapping string has the format "GUID,name,mapping", where GUID is the
788    /// string value from [`SDL_GUIDToString()`], name is the human readable string for
789    /// the device and mappings are gamepad mappings to joystick ones. Under
790    /// Windows there is a reserved GUID of "xinput" that covers all XInput
791    /// devices. The mapping format for joystick is:
792    ///
793    /// - `bX`: a joystick button, index X
794    /// - `hX.Y`: hat X with value Y
795    /// - `aX`: axis X of the joystick
796    ///
797    /// Buttons can be used as a gamepad axes and vice versa.
798    ///
799    /// If a device with this GUID is already plugged in, SDL will generate an
800    /// [`SDL_EVENT_GAMEPAD_ADDED`] event.
801    ///
802    /// This string shows an example of a valid mapping for a gamepad:
803    ///
804    /// ```c
805    /// "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"
806    /// ```
807    ///
808    /// ## Parameters
809    /// - `mapping`: the mapping string.
810    ///
811    /// ## Return value
812    /// Returns 1 if a new mapping is added, 0 if an existing mapping is updated,
813    ///   -1 on failure; call [`SDL_GetError()`] for more information.
814    ///
815    /// ## Thread safety
816    /// It is safe to call this function from any thread.
817    ///
818    /// ## Availability
819    /// This function is available since SDL 3.2.0.
820    ///
821    /// ## See also
822    /// - [`SDL_AddGamepadMappingsFromFile`]
823    /// - [`SDL_AddGamepadMappingsFromIO`]
824    /// - [`SDL_GetGamepadMapping`]
825    /// - [`SDL_GetGamepadMappingForGUID`]
826    /// - [`SDL_HINT_GAMECONTROLLERCONFIG`]
827    /// - [`SDL_HINT_GAMECONTROLLERCONFIG_FILE`]
828    /// - [`SDL_EVENT_GAMEPAD_ADDED`]
829    pub fn SDL_AddGamepadMapping(mapping: *const ::core::ffi::c_char) -> ::core::ffi::c_int;
830}
831
832unsafe extern "C" {
833    /// Load a set of gamepad mappings from an [`SDL_IOStream`].
834    ///
835    /// You can call this function several times, if needed, to load different
836    /// database files.
837    ///
838    /// If a new mapping is loaded for an already known gamepad GUID, the later
839    /// version will overwrite the one currently loaded.
840    ///
841    /// Any new mappings for already plugged in controllers will generate
842    /// [`SDL_EVENT_GAMEPAD_ADDED`] events.
843    ///
844    /// Mappings not belonging to the current platform or with no platform field
845    /// specified will be ignored (i.e. mappings for Linux will be ignored in
846    /// Windows, etc).
847    ///
848    /// This function will load the text database entirely in memory before
849    /// processing it, so take this into consideration if you are in a memory
850    /// constrained environment.
851    ///
852    /// ## Parameters
853    /// - `src`: the data stream for the mappings to be added.
854    /// - `closeio`: if true, calls [`SDL_CloseIO()`] on `src` before returning, even
855    ///   in the case of an error.
856    ///
857    /// ## Return value
858    /// Returns the number of mappings added or -1 on failure; call [`SDL_GetError()`]
859    ///   for more information.
860    ///
861    /// ## Thread safety
862    /// It is safe to call this function from any thread.
863    ///
864    /// ## Availability
865    /// This function is available since SDL 3.2.0.
866    ///
867    /// ## See also
868    /// - [`SDL_AddGamepadMapping`]
869    /// - [`SDL_AddGamepadMappingsFromFile`]
870    /// - [`SDL_GetGamepadMapping`]
871    /// - [`SDL_GetGamepadMappingForGUID`]
872    /// - [`SDL_HINT_GAMECONTROLLERCONFIG`]
873    /// - [`SDL_HINT_GAMECONTROLLERCONFIG_FILE`]
874    /// - [`SDL_EVENT_GAMEPAD_ADDED`]
875    pub fn SDL_AddGamepadMappingsFromIO(
876        src: *mut SDL_IOStream,
877        closeio: ::core::primitive::bool,
878    ) -> ::core::ffi::c_int;
879}
880
881unsafe extern "C" {
882    /// Load a set of gamepad mappings from a file.
883    ///
884    /// You can call this function several times, if needed, to load different
885    /// database files.
886    ///
887    /// If a new mapping is loaded for an already known gamepad GUID, the later
888    /// version will overwrite the one currently loaded.
889    ///
890    /// Any new mappings for already plugged in controllers will generate
891    /// [`SDL_EVENT_GAMEPAD_ADDED`] events.
892    ///
893    /// Mappings not belonging to the current platform or with no platform field
894    /// specified will be ignored (i.e. mappings for Linux will be ignored in
895    /// Windows, etc).
896    ///
897    /// ## Parameters
898    /// - `file`: the mappings file to load.
899    ///
900    /// ## Return value
901    /// Returns the number of mappings added or -1 on failure; call [`SDL_GetError()`]
902    ///   for more information.
903    ///
904    /// ## Thread safety
905    /// It is safe to call this function from any thread.
906    ///
907    /// ## Availability
908    /// This function is available since SDL 3.2.0.
909    ///
910    /// ## See also
911    /// - [`SDL_AddGamepadMapping`]
912    /// - [`SDL_AddGamepadMappingsFromIO`]
913    /// - [`SDL_GetGamepadMapping`]
914    /// - [`SDL_GetGamepadMappingForGUID`]
915    /// - [`SDL_HINT_GAMECONTROLLERCONFIG`]
916    /// - [`SDL_HINT_GAMECONTROLLERCONFIG_FILE`]
917    /// - [`SDL_EVENT_GAMEPAD_ADDED`]
918    pub fn SDL_AddGamepadMappingsFromFile(file: *const ::core::ffi::c_char) -> ::core::ffi::c_int;
919}
920
921unsafe extern "C" {
922    /// Reinitialize the SDL mapping database to its initial state.
923    ///
924    /// This will generate gamepad events as needed if device mappings change.
925    ///
926    /// ## Return value
927    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
928    ///   information.
929    ///
930    /// ## Thread safety
931    /// It is safe to call this function from any thread.
932    ///
933    /// ## Availability
934    /// This function is available since SDL 3.2.0.
935    pub fn SDL_ReloadGamepadMappings() -> ::core::primitive::bool;
936}
937
938unsafe extern "C" {
939    /// Get the current gamepad mappings.
940    ///
941    /// ## Parameters
942    /// - `count`: a pointer filled in with the number of mappings returned, can
943    ///   be NULL.
944    ///
945    /// ## Return value
946    /// Returns an array of the mapping strings, NULL-terminated, or NULL on
947    ///   failure; call [`SDL_GetError()`] for more information. This is a
948    ///   single allocation that should be freed with [`SDL_free()`] when it is
949    ///   no longer needed.
950    ///
951    /// ## Thread safety
952    /// It is safe to call this function from any thread.
953    ///
954    /// ## Availability
955    /// This function is available since SDL 3.2.0.
956    pub fn SDL_GetGamepadMappings(count: *mut ::core::ffi::c_int) -> *mut *mut ::core::ffi::c_char;
957}
958
959unsafe extern "C" {
960    /// Get the gamepad mapping string for a given GUID.
961    ///
962    /// ## Parameters
963    /// - `guid`: a structure containing the GUID for which a mapping is desired.
964    ///
965    /// ## Return value
966    /// Returns a mapping string or NULL on failure; call [`SDL_GetError()`] for more
967    ///   information. This should be freed with [`SDL_free()`] when it is no
968    ///   longer needed.
969    ///
970    /// ## Thread safety
971    /// It is safe to call this function from any thread.
972    ///
973    /// ## Availability
974    /// This function is available since SDL 3.2.0.
975    ///
976    /// ## See also
977    /// - [`SDL_GetJoystickGUIDForID`]
978    /// - [`SDL_GetJoystickGUID`]
979    pub fn SDL_GetGamepadMappingForGUID(guid: SDL_GUID) -> *mut ::core::ffi::c_char;
980}
981
982unsafe extern "C" {
983    /// Get the current mapping of a gamepad.
984    ///
985    /// Details about mappings are discussed with [`SDL_AddGamepadMapping()`].
986    ///
987    /// ## Parameters
988    /// - `gamepad`: the gamepad you want to get the current mapping for.
989    ///
990    /// ## Return value
991    /// Returns a string that has the gamepad's mapping or NULL if no mapping is
992    ///   available; call [`SDL_GetError()`] for more information. This should
993    ///   be freed with [`SDL_free()`] when it is no longer needed.
994    ///
995    /// ## Thread safety
996    /// It is safe to call this function from any thread.
997    ///
998    /// ## Availability
999    /// This function is available since SDL 3.2.0.
1000    ///
1001    /// ## See also
1002    /// - [`SDL_AddGamepadMapping`]
1003    /// - [`SDL_GetGamepadMappingForID`]
1004    /// - [`SDL_GetGamepadMappingForGUID`]
1005    /// - [`SDL_SetGamepadMapping`]
1006    pub fn SDL_GetGamepadMapping(gamepad: *mut SDL_Gamepad) -> *mut ::core::ffi::c_char;
1007}
1008
1009unsafe extern "C" {
1010    /// Set the current mapping of a joystick or gamepad.
1011    ///
1012    /// Details about mappings are discussed with [`SDL_AddGamepadMapping()`].
1013    ///
1014    /// ## Parameters
1015    /// - `instance_id`: the joystick instance ID.
1016    /// - `mapping`: the mapping to use for this device, or NULL to clear the
1017    ///   mapping.
1018    ///
1019    /// ## Return value
1020    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1021    ///   information.
1022    ///
1023    /// ## Thread safety
1024    /// It is safe to call this function from any thread.
1025    ///
1026    /// ## Availability
1027    /// This function is available since SDL 3.2.0.
1028    ///
1029    /// ## See also
1030    /// - [`SDL_AddGamepadMapping`]
1031    /// - [`SDL_GetGamepadMapping`]
1032    pub fn SDL_SetGamepadMapping(
1033        instance_id: SDL_JoystickID,
1034        mapping: *const ::core::ffi::c_char,
1035    ) -> ::core::primitive::bool;
1036}
1037
1038unsafe extern "C" {
1039    /// Return whether a gamepad is currently connected.
1040    ///
1041    /// ## Return value
1042    /// Returns true if a gamepad is connected, false otherwise.
1043    ///
1044    /// ## Thread safety
1045    /// It is safe to call this function from any thread.
1046    ///
1047    /// ## Availability
1048    /// This function is available since SDL 3.2.0.
1049    ///
1050    /// ## See also
1051    /// - [`SDL_GetGamepads`]
1052    pub fn SDL_HasGamepad() -> ::core::primitive::bool;
1053}
1054
1055unsafe extern "C" {
1056    /// Get a list of currently connected gamepads.
1057    ///
1058    /// ## Parameters
1059    /// - `count`: a pointer filled in with the number of gamepads returned, may
1060    ///   be NULL.
1061    ///
1062    /// ## Return value
1063    /// Returns a 0 terminated array of joystick instance IDs or NULL on failure;
1064    ///   call [`SDL_GetError()`] for more information. This should be freed
1065    ///   with [`SDL_free()`] when it is no longer needed.
1066    ///
1067    /// ## Thread safety
1068    /// It is safe to call this function from any thread.
1069    ///
1070    /// ## Availability
1071    /// This function is available since SDL 3.2.0.
1072    ///
1073    /// ## See also
1074    /// - [`SDL_HasGamepad`]
1075    /// - [`SDL_OpenGamepad`]
1076    pub fn SDL_GetGamepads(count: *mut ::core::ffi::c_int) -> *mut SDL_JoystickID;
1077}
1078
1079unsafe extern "C" {
1080    /// Check if the given joystick is supported by the gamepad interface.
1081    ///
1082    /// ## Parameters
1083    /// - `instance_id`: the joystick instance ID.
1084    ///
1085    /// ## Return value
1086    /// Returns true if the given joystick is supported by the gamepad interface,
1087    ///   false if it isn't or it's an invalid index.
1088    ///
1089    /// ## Thread safety
1090    /// It is safe to call this function from any thread.
1091    ///
1092    /// ## Availability
1093    /// This function is available since SDL 3.2.0.
1094    ///
1095    /// ## See also
1096    /// - [`SDL_GetJoysticks`]
1097    /// - [`SDL_OpenGamepad`]
1098    pub fn SDL_IsGamepad(instance_id: SDL_JoystickID) -> ::core::primitive::bool;
1099}
1100
1101unsafe extern "C" {
1102    /// Get the implementation dependent name of a gamepad.
1103    ///
1104    /// This can be called before any gamepads are opened.
1105    ///
1106    /// ## Parameters
1107    /// - `instance_id`: the joystick instance ID.
1108    ///
1109    /// ## Return value
1110    /// Returns the name of the selected gamepad. If no name can be found, this
1111    ///   function returns NULL; call [`SDL_GetError()`] for more information.
1112    ///
1113    /// ## Thread safety
1114    /// It is safe to call this function from any thread.
1115    ///
1116    /// ## Availability
1117    /// This function is available since SDL 3.2.0.
1118    ///
1119    /// ## See also
1120    /// - [`SDL_GetGamepadName`]
1121    /// - [`SDL_GetGamepads`]
1122    pub fn SDL_GetGamepadNameForID(instance_id: SDL_JoystickID) -> *const ::core::ffi::c_char;
1123}
1124
1125unsafe extern "C" {
1126    /// Get the implementation dependent path of a gamepad.
1127    ///
1128    /// This can be called before any gamepads are opened.
1129    ///
1130    /// ## Parameters
1131    /// - `instance_id`: the joystick instance ID.
1132    ///
1133    /// ## Return value
1134    /// Returns the path of the selected gamepad. If no path can be found, this
1135    ///   function returns NULL; call [`SDL_GetError()`] for more information.
1136    ///
1137    /// ## Thread safety
1138    /// It is safe to call this function from any thread.
1139    ///
1140    /// ## Availability
1141    /// This function is available since SDL 3.2.0.
1142    ///
1143    /// ## See also
1144    /// - [`SDL_GetGamepadPath`]
1145    /// - [`SDL_GetGamepads`]
1146    pub fn SDL_GetGamepadPathForID(instance_id: SDL_JoystickID) -> *const ::core::ffi::c_char;
1147}
1148
1149unsafe extern "C" {
1150    /// Get the player index of a gamepad.
1151    ///
1152    /// This can be called before any gamepads are opened.
1153    ///
1154    /// ## Parameters
1155    /// - `instance_id`: the joystick instance ID.
1156    ///
1157    /// ## Return value
1158    /// Returns the player index of a gamepad, or -1 if it's not available.
1159    ///
1160    /// ## Thread safety
1161    /// It is safe to call this function from any thread.
1162    ///
1163    /// ## Availability
1164    /// This function is available since SDL 3.2.0.
1165    ///
1166    /// ## See also
1167    /// - [`SDL_GetGamepadPlayerIndex`]
1168    /// - [`SDL_GetGamepads`]
1169    pub fn SDL_GetGamepadPlayerIndexForID(instance_id: SDL_JoystickID) -> ::core::ffi::c_int;
1170}
1171
1172unsafe extern "C" {
1173    /// Get the implementation-dependent GUID of a gamepad.
1174    ///
1175    /// This can be called before any gamepads are opened.
1176    ///
1177    /// ## Parameters
1178    /// - `instance_id`: the joystick instance ID.
1179    ///
1180    /// ## Return value
1181    /// Returns the GUID of the selected gamepad. If called on an invalid index,
1182    ///   this function returns a zero GUID.
1183    ///
1184    /// ## Thread safety
1185    /// It is safe to call this function from any thread.
1186    ///
1187    /// ## Availability
1188    /// This function is available since SDL 3.2.0.
1189    ///
1190    /// ## See also
1191    /// - [`SDL_GUIDToString`]
1192    /// - [`SDL_GetGamepads`]
1193    pub fn SDL_GetGamepadGUIDForID(instance_id: SDL_JoystickID) -> SDL_GUID;
1194}
1195
1196unsafe extern "C" {
1197    /// Get the USB vendor ID of a gamepad, if available.
1198    ///
1199    /// This can be called before any gamepads are opened. If the vendor ID isn't
1200    /// available this function returns 0.
1201    ///
1202    /// ## Parameters
1203    /// - `instance_id`: the joystick instance ID.
1204    ///
1205    /// ## Return value
1206    /// Returns the USB vendor ID of the selected gamepad. If called on an invalid
1207    ///   index, this function returns zero.
1208    ///
1209    /// ## Thread safety
1210    /// It is safe to call this function from any thread.
1211    ///
1212    /// ## Availability
1213    /// This function is available since SDL 3.2.0.
1214    ///
1215    /// ## See also
1216    /// - [`SDL_GetGamepadVendor`]
1217    /// - [`SDL_GetGamepads`]
1218    pub fn SDL_GetGamepadVendorForID(instance_id: SDL_JoystickID) -> Uint16;
1219}
1220
1221unsafe extern "C" {
1222    /// Get the USB product ID of a gamepad, if available.
1223    ///
1224    /// This can be called before any gamepads are opened. If the product ID isn't
1225    /// available this function returns 0.
1226    ///
1227    /// ## Parameters
1228    /// - `instance_id`: the joystick instance ID.
1229    ///
1230    /// ## Return value
1231    /// Returns the USB product ID of the selected gamepad. If called on an
1232    ///   invalid index, this function returns zero.
1233    ///
1234    /// ## Thread safety
1235    /// It is safe to call this function from any thread.
1236    ///
1237    /// ## Availability
1238    /// This function is available since SDL 3.2.0.
1239    ///
1240    /// ## See also
1241    /// - [`SDL_GetGamepadProduct`]
1242    /// - [`SDL_GetGamepads`]
1243    pub fn SDL_GetGamepadProductForID(instance_id: SDL_JoystickID) -> Uint16;
1244}
1245
1246unsafe extern "C" {
1247    /// Get the product version of a gamepad, if available.
1248    ///
1249    /// This can be called before any gamepads are opened. If the product version
1250    /// isn't available this function returns 0.
1251    ///
1252    /// ## Parameters
1253    /// - `instance_id`: the joystick instance ID.
1254    ///
1255    /// ## Return value
1256    /// Returns the product version of the selected gamepad. If called on an
1257    ///   invalid index, this function returns zero.
1258    ///
1259    /// ## Thread safety
1260    /// It is safe to call this function from any thread.
1261    ///
1262    /// ## Availability
1263    /// This function is available since SDL 3.2.0.
1264    ///
1265    /// ## See also
1266    /// - [`SDL_GetGamepadProductVersion`]
1267    /// - [`SDL_GetGamepads`]
1268    pub fn SDL_GetGamepadProductVersionForID(instance_id: SDL_JoystickID) -> Uint16;
1269}
1270
1271unsafe extern "C" {
1272    /// Get the type of a gamepad.
1273    ///
1274    /// This can be called before any gamepads are opened.
1275    ///
1276    /// ## Parameters
1277    /// - `instance_id`: the joystick instance ID.
1278    ///
1279    /// ## Return value
1280    /// Returns the gamepad type.
1281    ///
1282    /// ## Thread safety
1283    /// It is safe to call this function from any thread.
1284    ///
1285    /// ## Availability
1286    /// This function is available since SDL 3.2.0.
1287    ///
1288    /// ## See also
1289    /// - [`SDL_GetGamepadType`]
1290    /// - [`SDL_GetGamepads`]
1291    /// - [`SDL_GetRealGamepadTypeForID`]
1292    pub fn SDL_GetGamepadTypeForID(instance_id: SDL_JoystickID) -> SDL_GamepadType;
1293}
1294
1295unsafe extern "C" {
1296    /// Get the type of a gamepad, ignoring any mapping override.
1297    ///
1298    /// This can be called before any gamepads are opened.
1299    ///
1300    /// ## Parameters
1301    /// - `instance_id`: the joystick instance ID.
1302    ///
1303    /// ## Return value
1304    /// Returns the gamepad type.
1305    ///
1306    /// ## Thread safety
1307    /// It is safe to call this function from any thread.
1308    ///
1309    /// ## Availability
1310    /// This function is available since SDL 3.2.0.
1311    ///
1312    /// ## See also
1313    /// - [`SDL_GetGamepadTypeForID`]
1314    /// - [`SDL_GetGamepads`]
1315    /// - [`SDL_GetRealGamepadType`]
1316    pub fn SDL_GetRealGamepadTypeForID(instance_id: SDL_JoystickID) -> SDL_GamepadType;
1317}
1318
1319unsafe extern "C" {
1320    /// Get the mapping of a gamepad.
1321    ///
1322    /// This can be called before any gamepads are opened.
1323    ///
1324    /// ## Parameters
1325    /// - `instance_id`: the joystick instance ID.
1326    ///
1327    /// ## Return value
1328    /// Returns the mapping string. Returns NULL if no mapping is available. This
1329    ///   should be freed with [`SDL_free()`] when it is no longer needed.
1330    ///
1331    /// ## Thread safety
1332    /// It is safe to call this function from any thread.
1333    ///
1334    /// ## Availability
1335    /// This function is available since SDL 3.2.0.
1336    ///
1337    /// ## See also
1338    /// - [`SDL_GetGamepads`]
1339    /// - [`SDL_GetGamepadMapping`]
1340    pub fn SDL_GetGamepadMappingForID(instance_id: SDL_JoystickID) -> *mut ::core::ffi::c_char;
1341}
1342
1343unsafe extern "C" {
1344    /// Open a gamepad for use.
1345    ///
1346    /// ## Parameters
1347    /// - `instance_id`: the joystick instance ID.
1348    ///
1349    /// ## Return value
1350    /// Returns a gamepad identifier or NULL if an error occurred; call
1351    ///   [`SDL_GetError()`] for more information.
1352    ///
1353    /// ## Thread safety
1354    /// It is safe to call this function from any thread.
1355    ///
1356    /// ## Availability
1357    /// This function is available since SDL 3.2.0.
1358    ///
1359    /// ## See also
1360    /// - [`SDL_CloseGamepad`]
1361    /// - [`SDL_IsGamepad`]
1362    pub fn SDL_OpenGamepad(instance_id: SDL_JoystickID) -> *mut SDL_Gamepad;
1363}
1364
1365unsafe extern "C" {
1366    /// Get the [`SDL_Gamepad`] associated with a joystick instance ID, if it has been
1367    /// opened.
1368    ///
1369    /// ## Parameters
1370    /// - `instance_id`: the joystick instance ID of the gamepad.
1371    ///
1372    /// ## Return value
1373    /// Returns an [`SDL_Gamepad`] on success or NULL on failure or if it hasn't been
1374    ///   opened yet; call [`SDL_GetError()`] for more information.
1375    ///
1376    /// ## Thread safety
1377    /// It is safe to call this function from any thread.
1378    ///
1379    /// ## Availability
1380    /// This function is available since SDL 3.2.0.
1381    pub fn SDL_GetGamepadFromID(instance_id: SDL_JoystickID) -> *mut SDL_Gamepad;
1382}
1383
1384unsafe extern "C" {
1385    /// Get the [`SDL_Gamepad`] associated with a player index.
1386    ///
1387    /// ## Parameters
1388    /// - `player_index`: the player index, which different from the instance ID.
1389    ///
1390    /// ## Return value
1391    /// Returns the [`SDL_Gamepad`] associated with a player index.
1392    ///
1393    /// ## Thread safety
1394    /// It is safe to call this function from any thread.
1395    ///
1396    /// ## Availability
1397    /// This function is available since SDL 3.2.0.
1398    ///
1399    /// ## See also
1400    /// - [`SDL_GetGamepadPlayerIndex`]
1401    /// - [`SDL_SetGamepadPlayerIndex`]
1402    pub fn SDL_GetGamepadFromPlayerIndex(player_index: ::core::ffi::c_int) -> *mut SDL_Gamepad;
1403}
1404
1405unsafe extern "C" {
1406    /// Get the properties associated with an opened gamepad.
1407    ///
1408    /// These properties are shared with the underlying joystick object.
1409    ///
1410    /// The following read-only properties are provided by SDL:
1411    ///
1412    /// - [`SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN`]\: true if this gamepad has an LED
1413    ///   that has adjustable brightness
1414    /// - [`SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN`]\: true if this gamepad has an LED
1415    ///   that has adjustable color
1416    /// - [`SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN`]\: true if this gamepad has a
1417    ///   player LED
1418    /// - [`SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN`]\: true if this gamepad has
1419    ///   left/right rumble
1420    /// - [`SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN`]\: true if this gamepad has
1421    ///   simple trigger rumble
1422    ///
1423    /// ## Parameters
1424    /// - `gamepad`: a gamepad identifier previously returned by
1425    ///   [`SDL_OpenGamepad()`].
1426    ///
1427    /// ## Return value
1428    /// Returns a valid property ID on success or 0 on failure; call
1429    ///   [`SDL_GetError()`] for more information.
1430    ///
1431    /// ## Thread safety
1432    /// It is safe to call this function from any thread.
1433    ///
1434    /// ## Availability
1435    /// This function is available since SDL 3.2.0.
1436    pub fn SDL_GetGamepadProperties(gamepad: *mut SDL_Gamepad) -> SDL_PropertiesID;
1437}
1438
1439pub const SDL_PROP_GAMEPAD_CAP_MONO_LED_BOOLEAN: *const ::core::ffi::c_char =
1440    SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN;
1441
1442pub const SDL_PROP_GAMEPAD_CAP_RGB_LED_BOOLEAN: *const ::core::ffi::c_char =
1443    SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN;
1444
1445pub const SDL_PROP_GAMEPAD_CAP_PLAYER_LED_BOOLEAN: *const ::core::ffi::c_char =
1446    SDL_PROP_JOYSTICK_CAP_PLAYER_LED_BOOLEAN;
1447
1448pub const SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN: *const ::core::ffi::c_char =
1449    SDL_PROP_JOYSTICK_CAP_RUMBLE_BOOLEAN;
1450
1451pub const SDL_PROP_GAMEPAD_CAP_TRIGGER_RUMBLE_BOOLEAN: *const ::core::ffi::c_char =
1452    SDL_PROP_JOYSTICK_CAP_TRIGGER_RUMBLE_BOOLEAN;
1453
1454unsafe extern "C" {
1455    /// Get the instance ID of an opened gamepad.
1456    ///
1457    /// ## Parameters
1458    /// - `gamepad`: a gamepad identifier previously returned by
1459    ///   [`SDL_OpenGamepad()`].
1460    ///
1461    /// ## Return value
1462    /// Returns the instance ID of the specified gamepad on success or 0 on
1463    ///   failure; call [`SDL_GetError()`] for more information.
1464    ///
1465    /// ## Thread safety
1466    /// It is safe to call this function from any thread.
1467    ///
1468    /// ## Availability
1469    /// This function is available since SDL 3.2.0.
1470    pub fn SDL_GetGamepadID(gamepad: *mut SDL_Gamepad) -> SDL_JoystickID;
1471}
1472
1473unsafe extern "C" {
1474    /// Get the implementation-dependent name for an opened gamepad.
1475    ///
1476    /// ## Parameters
1477    /// - `gamepad`: a gamepad identifier previously returned by
1478    ///   [`SDL_OpenGamepad()`].
1479    ///
1480    /// ## Return value
1481    /// Returns the implementation dependent name for the gamepad, or NULL if
1482    ///   there is no name or the identifier passed is invalid.
1483    ///
1484    /// ## Thread safety
1485    /// It is safe to call this function from any thread.
1486    ///
1487    /// ## Availability
1488    /// This function is available since SDL 3.2.0.
1489    ///
1490    /// ## See also
1491    /// - [`SDL_GetGamepadNameForID`]
1492    pub fn SDL_GetGamepadName(gamepad: *mut SDL_Gamepad) -> *const ::core::ffi::c_char;
1493}
1494
1495unsafe extern "C" {
1496    /// Get the implementation-dependent path for an opened gamepad.
1497    ///
1498    /// ## Parameters
1499    /// - `gamepad`: a gamepad identifier previously returned by
1500    ///   [`SDL_OpenGamepad()`].
1501    ///
1502    /// ## Return value
1503    /// Returns the implementation dependent path for the gamepad, or NULL if
1504    ///   there is no path or the identifier passed is invalid.
1505    ///
1506    /// ## Thread safety
1507    /// It is safe to call this function from any thread.
1508    ///
1509    /// ## Availability
1510    /// This function is available since SDL 3.2.0.
1511    ///
1512    /// ## See also
1513    /// - [`SDL_GetGamepadPathForID`]
1514    pub fn SDL_GetGamepadPath(gamepad: *mut SDL_Gamepad) -> *const ::core::ffi::c_char;
1515}
1516
1517unsafe extern "C" {
1518    /// Get the type of an opened gamepad.
1519    ///
1520    /// ## Parameters
1521    /// - `gamepad`: the gamepad object to query.
1522    ///
1523    /// ## Return value
1524    /// Returns the gamepad type, or [`SDL_GAMEPAD_TYPE_UNKNOWN`] if it's not
1525    ///   available.
1526    ///
1527    /// ## Thread safety
1528    /// It is safe to call this function from any thread.
1529    ///
1530    /// ## Availability
1531    /// This function is available since SDL 3.2.0.
1532    ///
1533    /// ## See also
1534    /// - [`SDL_GetGamepadTypeForID`]
1535    pub fn SDL_GetGamepadType(gamepad: *mut SDL_Gamepad) -> SDL_GamepadType;
1536}
1537
1538unsafe extern "C" {
1539    /// Get the type of an opened gamepad, ignoring any mapping override.
1540    ///
1541    /// ## Parameters
1542    /// - `gamepad`: the gamepad object to query.
1543    ///
1544    /// ## Return value
1545    /// Returns the gamepad type, or [`SDL_GAMEPAD_TYPE_UNKNOWN`] if it's not
1546    ///   available.
1547    ///
1548    /// ## Thread safety
1549    /// It is safe to call this function from any thread.
1550    ///
1551    /// ## Availability
1552    /// This function is available since SDL 3.2.0.
1553    ///
1554    /// ## See also
1555    /// - [`SDL_GetRealGamepadTypeForID`]
1556    pub fn SDL_GetRealGamepadType(gamepad: *mut SDL_Gamepad) -> SDL_GamepadType;
1557}
1558
1559unsafe extern "C" {
1560    /// Get the player index of an opened gamepad.
1561    ///
1562    /// For XInput gamepads this returns the XInput user index.
1563    ///
1564    /// ## Parameters
1565    /// - `gamepad`: the gamepad object to query.
1566    ///
1567    /// ## Return value
1568    /// Returns the player index for gamepad, or -1 if it's not available.
1569    ///
1570    /// ## Thread safety
1571    /// It is safe to call this function from any thread.
1572    ///
1573    /// ## Availability
1574    /// This function is available since SDL 3.2.0.
1575    ///
1576    /// ## See also
1577    /// - [`SDL_SetGamepadPlayerIndex`]
1578    pub fn SDL_GetGamepadPlayerIndex(gamepad: *mut SDL_Gamepad) -> ::core::ffi::c_int;
1579}
1580
1581unsafe extern "C" {
1582    /// Set the player index of an opened gamepad.
1583    ///
1584    /// ## Parameters
1585    /// - `gamepad`: the gamepad object to adjust.
1586    /// - `player_index`: player index to assign to this gamepad, or -1 to clear
1587    ///   the player index and turn off player LEDs.
1588    ///
1589    /// ## Return value
1590    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
1591    ///   information.
1592    ///
1593    /// ## Thread safety
1594    /// It is safe to call this function from any thread.
1595    ///
1596    /// ## Availability
1597    /// This function is available since SDL 3.2.0.
1598    ///
1599    /// ## See also
1600    /// - [`SDL_GetGamepadPlayerIndex`]
1601    pub fn SDL_SetGamepadPlayerIndex(
1602        gamepad: *mut SDL_Gamepad,
1603        player_index: ::core::ffi::c_int,
1604    ) -> ::core::primitive::bool;
1605}
1606
1607unsafe extern "C" {
1608    /// Get the USB vendor ID of an opened gamepad, if available.
1609    ///
1610    /// If the vendor ID isn't available this function returns 0.
1611    ///
1612    /// ## Parameters
1613    /// - `gamepad`: the gamepad object to query.
1614    ///
1615    /// ## Return value
1616    /// Returns the USB vendor ID, or zero if unavailable.
1617    ///
1618    /// ## Thread safety
1619    /// It is safe to call this function from any thread.
1620    ///
1621    /// ## Availability
1622    /// This function is available since SDL 3.2.0.
1623    ///
1624    /// ## See also
1625    /// - [`SDL_GetGamepadVendorForID`]
1626    pub fn SDL_GetGamepadVendor(gamepad: *mut SDL_Gamepad) -> Uint16;
1627}
1628
1629unsafe extern "C" {
1630    /// Get the USB product ID of an opened gamepad, if available.
1631    ///
1632    /// If the product ID isn't available this function returns 0.
1633    ///
1634    /// ## Parameters
1635    /// - `gamepad`: the gamepad object to query.
1636    ///
1637    /// ## Return value
1638    /// Returns the USB product ID, or zero if unavailable.
1639    ///
1640    /// ## Thread safety
1641    /// It is safe to call this function from any thread.
1642    ///
1643    /// ## Availability
1644    /// This function is available since SDL 3.2.0.
1645    ///
1646    /// ## See also
1647    /// - [`SDL_GetGamepadProductForID`]
1648    pub fn SDL_GetGamepadProduct(gamepad: *mut SDL_Gamepad) -> Uint16;
1649}
1650
1651unsafe extern "C" {
1652    /// Get the product version of an opened gamepad, if available.
1653    ///
1654    /// If the product version isn't available this function returns 0.
1655    ///
1656    /// ## Parameters
1657    /// - `gamepad`: the gamepad object to query.
1658    ///
1659    /// ## Return value
1660    /// Returns the USB product version, or zero if unavailable.
1661    ///
1662    /// ## Thread safety
1663    /// It is safe to call this function from any thread.
1664    ///
1665    /// ## Availability
1666    /// This function is available since SDL 3.2.0.
1667    ///
1668    /// ## See also
1669    /// - [`SDL_GetGamepadProductVersionForID`]
1670    pub fn SDL_GetGamepadProductVersion(gamepad: *mut SDL_Gamepad) -> Uint16;
1671}
1672
1673unsafe extern "C" {
1674    /// Get the firmware version of an opened gamepad, if available.
1675    ///
1676    /// If the firmware version isn't available this function returns 0.
1677    ///
1678    /// ## Parameters
1679    /// - `gamepad`: the gamepad object to query.
1680    ///
1681    /// ## Return value
1682    /// Returns the gamepad firmware version, or zero if unavailable.
1683    ///
1684    /// ## Thread safety
1685    /// It is safe to call this function from any thread.
1686    ///
1687    /// ## Availability
1688    /// This function is available since SDL 3.2.0.
1689    pub fn SDL_GetGamepadFirmwareVersion(gamepad: *mut SDL_Gamepad) -> Uint16;
1690}
1691
1692unsafe extern "C" {
1693    /// Get the serial number of an opened gamepad, if available.
1694    ///
1695    /// Returns the serial number of the gamepad, or NULL if it is not available.
1696    ///
1697    /// ## Parameters
1698    /// - `gamepad`: the gamepad object to query.
1699    ///
1700    /// ## Return value
1701    /// Returns the serial number, or NULL if unavailable.
1702    ///
1703    /// ## Thread safety
1704    /// It is safe to call this function from any thread.
1705    ///
1706    /// ## Availability
1707    /// This function is available since SDL 3.2.0.
1708    pub fn SDL_GetGamepadSerial(gamepad: *mut SDL_Gamepad) -> *const ::core::ffi::c_char;
1709}
1710
1711unsafe extern "C" {
1712    /// Get the Steam Input handle of an opened gamepad, if available.
1713    ///
1714    /// Returns an InputHandle_t for the gamepad that can be used with Steam Input
1715    /// API: <https://partner.steamgames.com/doc/api/ISteamInput>
1716    ///
1717    /// ## Parameters
1718    /// - `gamepad`: the gamepad object to query.
1719    ///
1720    /// ## Return value
1721    /// Returns the gamepad handle, or 0 if unavailable.
1722    ///
1723    /// ## Thread safety
1724    /// It is safe to call this function from any thread.
1725    ///
1726    /// ## Availability
1727    /// This function is available since SDL 3.2.0.
1728    pub fn SDL_GetGamepadSteamHandle(gamepad: *mut SDL_Gamepad) -> Uint64;
1729}
1730
1731unsafe extern "C" {
1732    /// Get the connection state of a gamepad.
1733    ///
1734    /// ## Parameters
1735    /// - `gamepad`: the gamepad object to query.
1736    ///
1737    /// ## Return value
1738    /// Returns the connection state on success or
1739    ///   [`SDL_JOYSTICK_CONNECTION_INVALID`] on failure; call [`SDL_GetError()`]
1740    ///   for more information.
1741    ///
1742    /// ## Thread safety
1743    /// It is safe to call this function from any thread.
1744    ///
1745    /// ## Availability
1746    /// This function is available since SDL 3.2.0.
1747    pub fn SDL_GetGamepadConnectionState(gamepad: *mut SDL_Gamepad) -> SDL_JoystickConnectionState;
1748}
1749
1750unsafe extern "C" {
1751    /// Get the battery state of a gamepad.
1752    ///
1753    /// You should never take a battery status as absolute truth. Batteries
1754    /// (especially failing batteries) are delicate hardware, and the values
1755    /// reported here are best estimates based on what that hardware reports. It's
1756    /// not uncommon for older batteries to lose stored power much faster than it
1757    /// reports, or completely drain when reporting it has 20 percent left, etc.
1758    ///
1759    /// ## Parameters
1760    /// - `gamepad`: the gamepad object to query.
1761    /// - `percent`: a pointer filled in with the percentage of battery life
1762    ///   left, between 0 and 100, or NULL to ignore. This will be
1763    ///   filled in with -1 we can't determine a value or there is no
1764    ///   battery.
1765    ///
1766    /// ## Return value
1767    /// Returns the current battery state.
1768    ///
1769    /// ## Thread safety
1770    /// It is safe to call this function from any thread.
1771    ///
1772    /// ## Availability
1773    /// This function is available since SDL 3.2.0.
1774    pub fn SDL_GetGamepadPowerInfo(
1775        gamepad: *mut SDL_Gamepad,
1776        percent: *mut ::core::ffi::c_int,
1777    ) -> SDL_PowerState;
1778}
1779
1780unsafe extern "C" {
1781    /// Check if a gamepad has been opened and is currently connected.
1782    ///
1783    /// ## Parameters
1784    /// - `gamepad`: a gamepad identifier previously returned by
1785    ///   [`SDL_OpenGamepad()`].
1786    ///
1787    /// ## Return value
1788    /// Returns true if the gamepad has been opened and is currently connected, or
1789    ///   false if not.
1790    ///
1791    /// ## Thread safety
1792    /// It is safe to call this function from any thread.
1793    ///
1794    /// ## Availability
1795    /// This function is available since SDL 3.2.0.
1796    pub fn SDL_GamepadConnected(gamepad: *mut SDL_Gamepad) -> ::core::primitive::bool;
1797}
1798
1799unsafe extern "C" {
1800    /// Get the underlying joystick from a gamepad.
1801    ///
1802    /// This function will give you a [`SDL_Joystick`] object, which allows you to use
1803    /// the [`SDL_Joystick`] functions with a [`SDL_Gamepad`] object. This would be useful
1804    /// for getting a joystick's position at any given time, even if it hasn't
1805    /// moved (moving it would produce an event, which would have the axis' value).
1806    ///
1807    /// The pointer returned is owned by the [`SDL_Gamepad`]. You should not call
1808    /// [`SDL_CloseJoystick()`] on it, for example, since doing so will likely cause
1809    /// SDL to crash.
1810    ///
1811    /// ## Parameters
1812    /// - `gamepad`: the gamepad object that you want to get a joystick from.
1813    ///
1814    /// ## Return value
1815    /// Returns an [`SDL_Joystick`] object, or NULL on failure; call [`SDL_GetError()`]
1816    ///   for more information.
1817    ///
1818    /// ## Thread safety
1819    /// It is safe to call this function from any thread.
1820    ///
1821    /// ## Availability
1822    /// This function is available since SDL 3.2.0.
1823    pub fn SDL_GetGamepadJoystick(gamepad: *mut SDL_Gamepad) -> *mut SDL_Joystick;
1824}
1825
1826unsafe extern "C" {
1827    /// Set the state of gamepad event processing.
1828    ///
1829    /// If gamepad events are disabled, you must call [`SDL_UpdateGamepads()`] yourself
1830    /// and check the state of the gamepad when you want gamepad information.
1831    ///
1832    /// ## Parameters
1833    /// - `enabled`: whether to process gamepad events or not.
1834    ///
1835    /// ## Thread safety
1836    /// It is safe to call this function from any thread.
1837    ///
1838    /// ## Availability
1839    /// This function is available since SDL 3.2.0.
1840    ///
1841    /// ## See also
1842    /// - [`SDL_GamepadEventsEnabled`]
1843    /// - [`SDL_UpdateGamepads`]
1844    pub fn SDL_SetGamepadEventsEnabled(enabled: ::core::primitive::bool);
1845}
1846
1847unsafe extern "C" {
1848    /// Query the state of gamepad event processing.
1849    ///
1850    /// If gamepad events are disabled, you must call [`SDL_UpdateGamepads()`] yourself
1851    /// and check the state of the gamepad when you want gamepad information.
1852    ///
1853    /// ## Return value
1854    /// Returns true if gamepad events are being processed, false otherwise.
1855    ///
1856    /// ## Thread safety
1857    /// It is safe to call this function from any thread.
1858    ///
1859    /// ## Availability
1860    /// This function is available since SDL 3.2.0.
1861    ///
1862    /// ## See also
1863    /// - [`SDL_SetGamepadEventsEnabled`]
1864    pub fn SDL_GamepadEventsEnabled() -> ::core::primitive::bool;
1865}
1866
1867unsafe extern "C" {
1868    /// Get the SDL joystick layer bindings for a gamepad.
1869    ///
1870    /// ## Parameters
1871    /// - `gamepad`: a gamepad.
1872    /// - `count`: a pointer filled in with the number of bindings returned.
1873    ///
1874    /// ## Return value
1875    /// Returns a NULL terminated array of pointers to bindings or NULL on
1876    ///   failure; call [`SDL_GetError()`] for more information. This is a
1877    ///   single allocation that should be freed with [`SDL_free()`] when it is
1878    ///   no longer needed.
1879    ///
1880    /// ## Thread safety
1881    /// It is safe to call this function from any thread.
1882    ///
1883    /// ## Availability
1884    /// This function is available since SDL 3.2.0.
1885    pub fn SDL_GetGamepadBindings(
1886        gamepad: *mut SDL_Gamepad,
1887        count: *mut ::core::ffi::c_int,
1888    ) -> *mut *mut SDL_GamepadBinding;
1889}
1890
1891unsafe extern "C" {
1892    /// Manually pump gamepad updates if not using the loop.
1893    ///
1894    /// This function is called automatically by the event loop if events are
1895    /// enabled. Under such circumstances, it will not be necessary to call this
1896    /// function.
1897    ///
1898    /// ## Thread safety
1899    /// It is safe to call this function from any thread.
1900    ///
1901    /// ## Availability
1902    /// This function is available since SDL 3.2.0.
1903    pub fn SDL_UpdateGamepads();
1904}
1905
1906unsafe extern "C" {
1907    /// Convert a string into [`SDL_GamepadType`] enum.
1908    ///
1909    /// This function is called internally to translate [`SDL_Gamepad`] mapping strings
1910    /// for the underlying joystick device into the consistent [`SDL_Gamepad`] mapping.
1911    /// You do not normally need to call this function unless you are parsing
1912    /// [`SDL_Gamepad`] mappings in your own code.
1913    ///
1914    /// ## Parameters
1915    /// - `str`: string representing a [`SDL_GamepadType`] type.
1916    ///
1917    /// ## Return value
1918    /// Returns the [`SDL_GamepadType`] enum corresponding to the input string, or
1919    ///   [`SDL_GAMEPAD_TYPE_UNKNOWN`] if no match was found.
1920    ///
1921    /// ## Thread safety
1922    /// It is safe to call this function from any thread.
1923    ///
1924    /// ## Availability
1925    /// This function is available since SDL 3.2.0.
1926    ///
1927    /// ## See also
1928    /// - [`SDL_GetGamepadStringForType`]
1929    pub fn SDL_GetGamepadTypeFromString(str: *const ::core::ffi::c_char) -> SDL_GamepadType;
1930}
1931
1932unsafe extern "C" {
1933    /// Convert from an [`SDL_GamepadType`] enum to a string.
1934    ///
1935    /// ## Parameters
1936    /// - `type`: an enum value for a given [`SDL_GamepadType`].
1937    ///
1938    /// ## Return value
1939    /// Returns a string for the given type, or NULL if an invalid type is
1940    ///   specified. The string returned is of the format used by
1941    ///   [`SDL_Gamepad`] mapping strings.
1942    ///
1943    /// ## Thread safety
1944    /// It is safe to call this function from any thread.
1945    ///
1946    /// ## Availability
1947    /// This function is available since SDL 3.2.0.
1948    ///
1949    /// ## See also
1950    /// - [`SDL_GetGamepadTypeFromString`]
1951    pub fn SDL_GetGamepadStringForType(r#type: SDL_GamepadType) -> *const ::core::ffi::c_char;
1952}
1953
1954unsafe extern "C" {
1955    /// Convert a string into [`SDL_GamepadAxis`] enum.
1956    ///
1957    /// This function is called internally to translate [`SDL_Gamepad`] mapping strings
1958    /// for the underlying joystick device into the consistent [`SDL_Gamepad`] mapping.
1959    /// You do not normally need to call this function unless you are parsing
1960    /// [`SDL_Gamepad`] mappings in your own code.
1961    ///
1962    /// Note specially that "righttrigger" and "lefttrigger" map to
1963    /// [`SDL_GAMEPAD_AXIS_RIGHT_TRIGGER`] and [`SDL_GAMEPAD_AXIS_LEFT_TRIGGER`],
1964    /// respectively.
1965    ///
1966    /// ## Parameters
1967    /// - `str`: string representing a [`SDL_Gamepad`] axis.
1968    ///
1969    /// ## Return value
1970    /// Returns the [`SDL_GamepadAxis`] enum corresponding to the input string, or
1971    ///   [`SDL_GAMEPAD_AXIS_INVALID`] if no match was found.
1972    ///
1973    /// ## Thread safety
1974    /// It is safe to call this function from any thread.
1975    ///
1976    /// ## Availability
1977    /// This function is available since SDL 3.2.0.
1978    ///
1979    /// ## See also
1980    /// - [`SDL_GetGamepadStringForAxis`]
1981    pub fn SDL_GetGamepadAxisFromString(str: *const ::core::ffi::c_char) -> SDL_GamepadAxis;
1982}
1983
1984unsafe extern "C" {
1985    /// Convert from an [`SDL_GamepadAxis`] enum to a string.
1986    ///
1987    /// ## Parameters
1988    /// - `axis`: an enum value for a given [`SDL_GamepadAxis`].
1989    ///
1990    /// ## Return value
1991    /// Returns a string for the given axis, or NULL if an invalid axis is
1992    ///   specified. The string returned is of the format used by
1993    ///   [`SDL_Gamepad`] mapping strings.
1994    ///
1995    /// ## Thread safety
1996    /// It is safe to call this function from any thread.
1997    ///
1998    /// ## Availability
1999    /// This function is available since SDL 3.2.0.
2000    ///
2001    /// ## See also
2002    /// - [`SDL_GetGamepadAxisFromString`]
2003    pub fn SDL_GetGamepadStringForAxis(axis: SDL_GamepadAxis) -> *const ::core::ffi::c_char;
2004}
2005
2006unsafe extern "C" {
2007    /// Query whether a gamepad has a given axis.
2008    ///
2009    /// This merely reports whether the gamepad's mapping defined this axis, as
2010    /// that is all the information SDL has about the physical device.
2011    ///
2012    /// ## Parameters
2013    /// - `gamepad`: a gamepad.
2014    /// - `axis`: an axis enum value (an [`SDL_GamepadAxis`] value).
2015    ///
2016    /// ## Return value
2017    /// Returns true if the gamepad has this axis, false otherwise.
2018    ///
2019    /// ## Thread safety
2020    /// It is safe to call this function from any thread.
2021    ///
2022    /// ## Availability
2023    /// This function is available since SDL 3.2.0.
2024    ///
2025    /// ## See also
2026    /// - [`SDL_GamepadHasButton`]
2027    /// - [`SDL_GetGamepadAxis`]
2028    pub fn SDL_GamepadHasAxis(
2029        gamepad: *mut SDL_Gamepad,
2030        axis: SDL_GamepadAxis,
2031    ) -> ::core::primitive::bool;
2032}
2033
2034unsafe extern "C" {
2035    /// Get the current state of an axis control on a gamepad.
2036    ///
2037    /// The axis indices start at index 0.
2038    ///
2039    /// For thumbsticks, the state is a value ranging from -32768 (up/left) to
2040    /// 32767 (down/right).
2041    ///
2042    /// Triggers range from 0 when released to 32767 when fully pressed, and never
2043    /// return a negative value. Note that this differs from the value reported by
2044    /// the lower-level [`SDL_GetJoystickAxis()`], which normally uses the full range.
2045    ///
2046    /// Note that for invalid gamepads or axes, this will return 0. Zero is also a
2047    /// valid value in normal operation; usually it means a centered axis.
2048    ///
2049    /// ## Parameters
2050    /// - `gamepad`: a gamepad.
2051    /// - `axis`: an axis index (one of the [`SDL_GamepadAxis`] values).
2052    ///
2053    /// ## Return value
2054    /// Returns axis state.
2055    ///
2056    /// ## Thread safety
2057    /// It is safe to call this function from any thread.
2058    ///
2059    /// ## Availability
2060    /// This function is available since SDL 3.2.0.
2061    ///
2062    /// ## See also
2063    /// - [`SDL_GamepadHasAxis`]
2064    /// - [`SDL_GetGamepadButton`]
2065    pub fn SDL_GetGamepadAxis(gamepad: *mut SDL_Gamepad, axis: SDL_GamepadAxis) -> Sint16;
2066}
2067
2068unsafe extern "C" {
2069    /// Convert a string into an [`SDL_GamepadButton`] enum.
2070    ///
2071    /// This function is called internally to translate [`SDL_Gamepad`] mapping strings
2072    /// for the underlying joystick device into the consistent [`SDL_Gamepad`] mapping.
2073    /// You do not normally need to call this function unless you are parsing
2074    /// [`SDL_Gamepad`] mappings in your own code.
2075    ///
2076    /// ## Parameters
2077    /// - `str`: string representing a [`SDL_Gamepad`] button.
2078    ///
2079    /// ## Return value
2080    /// Returns the [`SDL_GamepadButton`] enum corresponding to the input string, or
2081    ///   [`SDL_GAMEPAD_BUTTON_INVALID`] if no match was found.
2082    ///
2083    /// ## Thread safety
2084    /// It is safe to call this function from any thread.
2085    ///
2086    /// ## Availability
2087    /// This function is available since SDL 3.2.0.
2088    ///
2089    /// ## See also
2090    /// - [`SDL_GetGamepadStringForButton`]
2091    pub fn SDL_GetGamepadButtonFromString(str: *const ::core::ffi::c_char) -> SDL_GamepadButton;
2092}
2093
2094unsafe extern "C" {
2095    /// Convert from an [`SDL_GamepadButton`] enum to a string.
2096    ///
2097    /// ## Parameters
2098    /// - `button`: an enum value for a given [`SDL_GamepadButton`].
2099    ///
2100    /// ## Return value
2101    /// Returns a string for the given button, or NULL if an invalid button is
2102    ///   specified. The string returned is of the format used by
2103    ///   [`SDL_Gamepad`] mapping strings.
2104    ///
2105    /// ## Thread safety
2106    /// It is safe to call this function from any thread.
2107    ///
2108    /// ## Availability
2109    /// This function is available since SDL 3.2.0.
2110    ///
2111    /// ## See also
2112    /// - [`SDL_GetGamepadButtonFromString`]
2113    pub fn SDL_GetGamepadStringForButton(button: SDL_GamepadButton) -> *const ::core::ffi::c_char;
2114}
2115
2116unsafe extern "C" {
2117    /// Query whether a gamepad has a given button.
2118    ///
2119    /// This merely reports whether the gamepad's mapping defined this button, as
2120    /// that is all the information SDL has about the physical device.
2121    ///
2122    /// ## Parameters
2123    /// - `gamepad`: a gamepad.
2124    /// - `button`: a button enum value (an [`SDL_GamepadButton`] value).
2125    ///
2126    /// ## Return value
2127    /// Returns true if the gamepad has this button, false otherwise.
2128    ///
2129    /// ## Thread safety
2130    /// It is safe to call this function from any thread.
2131    ///
2132    /// ## Availability
2133    /// This function is available since SDL 3.2.0.
2134    ///
2135    /// ## See also
2136    /// - [`SDL_GamepadHasAxis`]
2137    pub fn SDL_GamepadHasButton(
2138        gamepad: *mut SDL_Gamepad,
2139        button: SDL_GamepadButton,
2140    ) -> ::core::primitive::bool;
2141}
2142
2143unsafe extern "C" {
2144    /// Get the current state of a button on a gamepad.
2145    ///
2146    /// ## Parameters
2147    /// - `gamepad`: a gamepad.
2148    /// - `button`: a button index (one of the [`SDL_GamepadButton`] values).
2149    ///
2150    /// ## Return value
2151    /// Returns true if the button is pressed, false otherwise.
2152    ///
2153    /// ## Thread safety
2154    /// It is safe to call this function from any thread.
2155    ///
2156    /// ## Availability
2157    /// This function is available since SDL 3.2.0.
2158    ///
2159    /// ## See also
2160    /// - [`SDL_GamepadHasButton`]
2161    /// - [`SDL_GetGamepadAxis`]
2162    pub fn SDL_GetGamepadButton(
2163        gamepad: *mut SDL_Gamepad,
2164        button: SDL_GamepadButton,
2165    ) -> ::core::primitive::bool;
2166}
2167
2168unsafe extern "C" {
2169    /// Get the label of a button on a gamepad.
2170    ///
2171    /// ## Parameters
2172    /// - `type`: the type of gamepad to check.
2173    /// - `button`: a button index (one of the [`SDL_GamepadButton`] values).
2174    ///
2175    /// ## Return value
2176    /// Returns the [`SDL_GamepadButtonLabel`] enum corresponding to the button label.
2177    ///
2178    /// ## Thread safety
2179    /// It is safe to call this function from any thread.
2180    ///
2181    /// ## Availability
2182    /// This function is available since SDL 3.2.0.
2183    ///
2184    /// ## See also
2185    /// - [`SDL_GetGamepadButtonLabel`]
2186    pub fn SDL_GetGamepadButtonLabelForType(
2187        r#type: SDL_GamepadType,
2188        button: SDL_GamepadButton,
2189    ) -> SDL_GamepadButtonLabel;
2190}
2191
2192unsafe extern "C" {
2193    /// Get the label of a button on a gamepad.
2194    ///
2195    /// ## Parameters
2196    /// - `gamepad`: a gamepad.
2197    /// - `button`: a button index (one of the [`SDL_GamepadButton`] values).
2198    ///
2199    /// ## Return value
2200    /// Returns the [`SDL_GamepadButtonLabel`] enum corresponding to the button label.
2201    ///
2202    /// ## Thread safety
2203    /// It is safe to call this function from any thread.
2204    ///
2205    /// ## Availability
2206    /// This function is available since SDL 3.2.0.
2207    ///
2208    /// ## See also
2209    /// - [`SDL_GetGamepadButtonLabelForType`]
2210    pub fn SDL_GetGamepadButtonLabel(
2211        gamepad: *mut SDL_Gamepad,
2212        button: SDL_GamepadButton,
2213    ) -> SDL_GamepadButtonLabel;
2214}
2215
2216unsafe extern "C" {
2217    /// Get the number of touchpads on a gamepad.
2218    ///
2219    /// ## Parameters
2220    /// - `gamepad`: a gamepad.
2221    ///
2222    /// ## Return value
2223    /// Returns number of touchpads.
2224    ///
2225    /// ## Thread safety
2226    /// It is safe to call this function from any thread.
2227    ///
2228    /// ## Availability
2229    /// This function is available since SDL 3.2.0.
2230    ///
2231    /// ## See also
2232    /// - [`SDL_GetNumGamepadTouchpadFingers`]
2233    pub fn SDL_GetNumGamepadTouchpads(gamepad: *mut SDL_Gamepad) -> ::core::ffi::c_int;
2234}
2235
2236unsafe extern "C" {
2237    /// Get the number of supported simultaneous fingers on a touchpad on a game
2238    /// gamepad.
2239    ///
2240    /// ## Parameters
2241    /// - `gamepad`: a gamepad.
2242    /// - `touchpad`: a touchpad.
2243    ///
2244    /// ## Return value
2245    /// Returns number of supported simultaneous fingers.
2246    ///
2247    /// ## Thread safety
2248    /// It is safe to call this function from any thread.
2249    ///
2250    /// ## Availability
2251    /// This function is available since SDL 3.2.0.
2252    ///
2253    /// ## See also
2254    /// - [`SDL_GetGamepadTouchpadFinger`]
2255    /// - [`SDL_GetNumGamepadTouchpads`]
2256    pub fn SDL_GetNumGamepadTouchpadFingers(
2257        gamepad: *mut SDL_Gamepad,
2258        touchpad: ::core::ffi::c_int,
2259    ) -> ::core::ffi::c_int;
2260}
2261
2262unsafe extern "C" {
2263    /// Get the current state of a finger on a touchpad on a gamepad.
2264    ///
2265    /// ## Parameters
2266    /// - `gamepad`: a gamepad.
2267    /// - `touchpad`: a touchpad.
2268    /// - `finger`: a finger.
2269    /// - `down`: a pointer filled with true if the finger is down, false
2270    ///   otherwise, may be NULL.
2271    /// - `x`: a pointer filled with the x position, normalized 0 to 1, with the
2272    ///   origin in the upper left, may be NULL.
2273    /// - `y`: a pointer filled with the y position, normalized 0 to 1, with the
2274    ///   origin in the upper left, may be NULL.
2275    /// - `pressure`: a pointer filled with pressure value, may be NULL.
2276    ///
2277    /// ## Return value
2278    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2279    ///   information.
2280    ///
2281    /// ## Thread safety
2282    /// It is safe to call this function from any thread.
2283    ///
2284    /// ## Availability
2285    /// This function is available since SDL 3.2.0.
2286    ///
2287    /// ## See also
2288    /// - [`SDL_GetNumGamepadTouchpadFingers`]
2289    pub fn SDL_GetGamepadTouchpadFinger(
2290        gamepad: *mut SDL_Gamepad,
2291        touchpad: ::core::ffi::c_int,
2292        finger: ::core::ffi::c_int,
2293        down: *mut ::core::primitive::bool,
2294        x: *mut ::core::ffi::c_float,
2295        y: *mut ::core::ffi::c_float,
2296        pressure: *mut ::core::ffi::c_float,
2297    ) -> ::core::primitive::bool;
2298}
2299
2300unsafe extern "C" {
2301    /// Return whether a gamepad has a particular sensor.
2302    ///
2303    /// ## Parameters
2304    /// - `gamepad`: the gamepad to query.
2305    /// - `type`: the type of sensor to query.
2306    ///
2307    /// ## Return value
2308    /// Returns true if the sensor exists, false otherwise.
2309    ///
2310    /// ## Thread safety
2311    /// It is safe to call this function from any thread.
2312    ///
2313    /// ## Availability
2314    /// This function is available since SDL 3.2.0.
2315    ///
2316    /// ## See also
2317    /// - [`SDL_GetGamepadSensorData`]
2318    /// - [`SDL_GetGamepadSensorDataRate`]
2319    /// - [`SDL_SetGamepadSensorEnabled`]
2320    pub fn SDL_GamepadHasSensor(
2321        gamepad: *mut SDL_Gamepad,
2322        r#type: SDL_SensorType,
2323    ) -> ::core::primitive::bool;
2324}
2325
2326unsafe extern "C" {
2327    /// Set whether data reporting for a gamepad sensor is enabled.
2328    ///
2329    /// ## Parameters
2330    /// - `gamepad`: the gamepad to update.
2331    /// - `type`: the type of sensor to enable/disable.
2332    /// - `enabled`: whether data reporting should be enabled.
2333    ///
2334    /// ## Return value
2335    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2336    ///   information.
2337    ///
2338    /// ## Thread safety
2339    /// It is safe to call this function from any thread.
2340    ///
2341    /// ## Availability
2342    /// This function is available since SDL 3.2.0.
2343    ///
2344    /// ## See also
2345    /// - [`SDL_GamepadHasSensor`]
2346    /// - [`SDL_GamepadSensorEnabled`]
2347    pub fn SDL_SetGamepadSensorEnabled(
2348        gamepad: *mut SDL_Gamepad,
2349        r#type: SDL_SensorType,
2350        enabled: ::core::primitive::bool,
2351    ) -> ::core::primitive::bool;
2352}
2353
2354unsafe extern "C" {
2355    /// Query whether sensor data reporting is enabled for a gamepad.
2356    ///
2357    /// ## Parameters
2358    /// - `gamepad`: the gamepad to query.
2359    /// - `type`: the type of sensor to query.
2360    ///
2361    /// ## Return value
2362    /// Returns true if the sensor is enabled, false otherwise.
2363    ///
2364    /// ## Thread safety
2365    /// It is safe to call this function from any thread.
2366    ///
2367    /// ## Availability
2368    /// This function is available since SDL 3.2.0.
2369    ///
2370    /// ## See also
2371    /// - [`SDL_SetGamepadSensorEnabled`]
2372    pub fn SDL_GamepadSensorEnabled(
2373        gamepad: *mut SDL_Gamepad,
2374        r#type: SDL_SensorType,
2375    ) -> ::core::primitive::bool;
2376}
2377
2378unsafe extern "C" {
2379    /// Get the data rate (number of events per second) of a gamepad sensor.
2380    ///
2381    /// ## Parameters
2382    /// - `gamepad`: the gamepad to query.
2383    /// - `type`: the type of sensor to query.
2384    ///
2385    /// ## Return value
2386    /// Returns the data rate, or 0.0f if the data rate is not available.
2387    ///
2388    /// ## Thread safety
2389    /// It is safe to call this function from any thread.
2390    ///
2391    /// ## Availability
2392    /// This function is available since SDL 3.2.0.
2393    pub fn SDL_GetGamepadSensorDataRate(
2394        gamepad: *mut SDL_Gamepad,
2395        r#type: SDL_SensorType,
2396    ) -> ::core::ffi::c_float;
2397}
2398
2399unsafe extern "C" {
2400    /// Get the current state of a gamepad sensor.
2401    ///
2402    /// The number of values and interpretation of the data is sensor dependent.
2403    /// See the remarks in [`SDL_SensorType`] for details for each type of sensor.
2404    ///
2405    /// ## Parameters
2406    /// - `gamepad`: the gamepad to query.
2407    /// - `type`: the type of sensor to query.
2408    /// - `data`: a pointer filled with the current sensor state.
2409    /// - `num_values`: the number of values to write to data.
2410    ///
2411    /// ## Return value
2412    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2413    ///   information.
2414    ///
2415    /// ## Thread safety
2416    /// It is safe to call this function from any thread.
2417    ///
2418    /// ## Availability
2419    /// This function is available since SDL 3.2.0.
2420    pub fn SDL_GetGamepadSensorData(
2421        gamepad: *mut SDL_Gamepad,
2422        r#type: SDL_SensorType,
2423        data: *mut ::core::ffi::c_float,
2424        num_values: ::core::ffi::c_int,
2425    ) -> ::core::primitive::bool;
2426}
2427
2428unsafe extern "C" {
2429    /// Start a rumble effect on a gamepad.
2430    ///
2431    /// Each call to this function cancels any previous rumble effect, and calling
2432    /// it with 0 intensity stops any rumbling.
2433    ///
2434    /// This function requires you to process SDL events or call
2435    /// [`SDL_UpdateJoysticks()`] to update rumble state.
2436    ///
2437    /// ## Parameters
2438    /// - `gamepad`: the gamepad to vibrate.
2439    /// - `low_frequency_rumble`: the intensity of the low frequency (left)
2440    ///   rumble motor, from 0 to 0xFFFF.
2441    /// - `high_frequency_rumble`: the intensity of the high frequency (right)
2442    ///   rumble motor, from 0 to 0xFFFF.
2443    /// - `duration_ms`: the duration of the rumble effect, in milliseconds.
2444    ///
2445    /// ## Return value
2446    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2447    ///   information.
2448    ///
2449    /// ## Thread safety
2450    /// It is safe to call this function from any thread.
2451    ///
2452    /// ## Availability
2453    /// This function is available since SDL 3.2.0.
2454    pub fn SDL_RumbleGamepad(
2455        gamepad: *mut SDL_Gamepad,
2456        low_frequency_rumble: Uint16,
2457        high_frequency_rumble: Uint16,
2458        duration_ms: Uint32,
2459    ) -> ::core::primitive::bool;
2460}
2461
2462unsafe extern "C" {
2463    /// Start a rumble effect in the gamepad's triggers.
2464    ///
2465    /// Each call to this function cancels any previous trigger rumble effect, and
2466    /// calling it with 0 intensity stops any rumbling.
2467    ///
2468    /// Note that this is rumbling of the _triggers_ and not the gamepad as a
2469    /// whole. This is currently only supported on Xbox One gamepads. If you want
2470    /// the (more common) whole-gamepad rumble, use [`SDL_RumbleGamepad()`] instead.
2471    ///
2472    /// This function requires you to process SDL events or call
2473    /// [`SDL_UpdateJoysticks()`] to update rumble state.
2474    ///
2475    /// ## Parameters
2476    /// - `gamepad`: the gamepad to vibrate.
2477    /// - `left_rumble`: the intensity of the left trigger rumble motor, from 0
2478    ///   to 0xFFFF.
2479    /// - `right_rumble`: the intensity of the right trigger rumble motor, from 0
2480    ///   to 0xFFFF.
2481    /// - `duration_ms`: the duration of the rumble effect, in milliseconds.
2482    ///
2483    /// ## Return value
2484    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2485    ///   information.
2486    ///
2487    /// ## Thread safety
2488    /// It is safe to call this function from any thread.
2489    ///
2490    /// ## Availability
2491    /// This function is available since SDL 3.2.0.
2492    ///
2493    /// ## See also
2494    /// - [`SDL_RumbleGamepad`]
2495    pub fn SDL_RumbleGamepadTriggers(
2496        gamepad: *mut SDL_Gamepad,
2497        left_rumble: Uint16,
2498        right_rumble: Uint16,
2499        duration_ms: Uint32,
2500    ) -> ::core::primitive::bool;
2501}
2502
2503unsafe extern "C" {
2504    /// Update a gamepad's LED color.
2505    ///
2506    /// An example of a joystick LED is the light on the back of a PlayStation 4's
2507    /// DualShock 4 controller.
2508    ///
2509    /// For gamepads with a single color LED, the maximum of the RGB values will be
2510    /// used as the LED brightness.
2511    ///
2512    /// ## Parameters
2513    /// - `gamepad`: the gamepad to update.
2514    /// - `red`: the intensity of the red LED.
2515    /// - `green`: the intensity of the green LED.
2516    /// - `blue`: the intensity of the blue LED.
2517    ///
2518    /// ## Return value
2519    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2520    ///   information.
2521    ///
2522    /// ## Thread safety
2523    /// It is safe to call this function from any thread.
2524    ///
2525    /// ## Availability
2526    /// This function is available since SDL 3.2.0.
2527    pub fn SDL_SetGamepadLED(
2528        gamepad: *mut SDL_Gamepad,
2529        red: Uint8,
2530        green: Uint8,
2531        blue: Uint8,
2532    ) -> ::core::primitive::bool;
2533}
2534
2535unsafe extern "C" {
2536    /// Send a gamepad specific effect packet.
2537    ///
2538    /// ## Parameters
2539    /// - `gamepad`: the gamepad to affect.
2540    /// - `data`: the data to send to the gamepad.
2541    /// - `size`: the size of the data to send to the gamepad.
2542    ///
2543    /// ## Return value
2544    /// Returns true on success or false on failure; call [`SDL_GetError()`] for more
2545    ///   information.
2546    ///
2547    /// ## Thread safety
2548    /// It is safe to call this function from any thread.
2549    ///
2550    /// ## Availability
2551    /// This function is available since SDL 3.2.0.
2552    pub fn SDL_SendGamepadEffect(
2553        gamepad: *mut SDL_Gamepad,
2554        data: *const ::core::ffi::c_void,
2555        size: ::core::ffi::c_int,
2556    ) -> ::core::primitive::bool;
2557}
2558
2559unsafe extern "C" {
2560    /// Close a gamepad previously opened with [`SDL_OpenGamepad()`].
2561    ///
2562    /// ## Parameters
2563    /// - `gamepad`: a gamepad identifier previously returned by
2564    ///   [`SDL_OpenGamepad()`].
2565    ///
2566    /// ## Thread safety
2567    /// It is safe to call this function from any thread.
2568    ///
2569    /// ## Availability
2570    /// This function is available since SDL 3.2.0.
2571    ///
2572    /// ## See also
2573    /// - [`SDL_OpenGamepad`]
2574    pub fn SDL_CloseGamepad(gamepad: *mut SDL_Gamepad);
2575}
2576
2577unsafe extern "C" {
2578    /// Return the sfSymbolsName for a given button on a gamepad on Apple
2579    /// platforms.
2580    ///
2581    /// ## Parameters
2582    /// - `gamepad`: the gamepad to query.
2583    /// - `button`: a button on the gamepad.
2584    ///
2585    /// ## Return value
2586    /// Returns the sfSymbolsName or NULL if the name can't be found.
2587    ///
2588    /// ## Thread safety
2589    /// It is safe to call this function from any thread.
2590    ///
2591    /// ## Availability
2592    /// This function is available since SDL 3.2.0.
2593    ///
2594    /// ## See also
2595    /// - [`SDL_GetGamepadAppleSFSymbolsNameForAxis`]
2596    pub fn SDL_GetGamepadAppleSFSymbolsNameForButton(
2597        gamepad: *mut SDL_Gamepad,
2598        button: SDL_GamepadButton,
2599    ) -> *const ::core::ffi::c_char;
2600}
2601
2602unsafe extern "C" {
2603    /// Return the sfSymbolsName for a given axis on a gamepad on Apple platforms.
2604    ///
2605    /// ## Parameters
2606    /// - `gamepad`: the gamepad to query.
2607    /// - `axis`: an axis on the gamepad.
2608    ///
2609    /// ## Return value
2610    /// Returns the sfSymbolsName or NULL if the name can't be found.
2611    ///
2612    /// ## Thread safety
2613    /// It is safe to call this function from any thread.
2614    ///
2615    /// ## Availability
2616    /// This function is available since SDL 3.2.0.
2617    ///
2618    /// ## See also
2619    /// - [`SDL_GetGamepadAppleSFSymbolsNameForButton`]
2620    pub fn SDL_GetGamepadAppleSFSymbolsNameForAxis(
2621        gamepad: *mut SDL_Gamepad,
2622        axis: SDL_GamepadAxis,
2623    ) -> *const ::core::ffi::c_char;
2624}
2625
2626/// The structure used to identify an SDL gamepad
2627///
2628/// ## Availability
2629/// This struct is available since SDL 3.2.0.
2630#[repr(C)]
2631pub struct SDL_Gamepad {
2632    _opaque: [::core::primitive::u8; 0],
2633}
2634
2635#[cfg(doc)]
2636use crate::everything::*;