Struct SDL_GamepadButton
#[repr(transparent)]pub struct SDL_GamepadButton(pub i32);
dep_sdl3
only.Expand description
The list of buttons available on a gamepad
For controllers that use a diamond pattern for the face buttons, the south/east/west/north buttons below correspond to the locations in the diamond pattern. For Xbox controllers, this would be A/B/X/Y, for Nintendo Switch controllers, this would be B/A/Y/X, for PlayStation controllers this would be Cross/Circle/Square/Triangle.
For controllers that don’t use a diamond pattern for the face buttons, the south/east/west/north buttons indicate the buttons labeled A, B, C, D, or 1, 2, 3, 4, or for controllers that aren’t labeled, they are the primary, secondary, etc. buttons.
The activate action is often the south button and the cancel action is often the east button, but in some regions this is reversed, so your game should allow remapping actions based on user preferences.
You can query the labels for the face buttons using
SDL_GetGamepadButtonLabel()
§Availability
This enum is available since SDL 3.2.0.
§Known values (sdl3-sys
)
Tuple Fields§
§0: i32
Implementations§
§impl SDL_GamepadButton
impl SDL_GamepadButton
pub const INVALID: SDL_GamepadButton
pub const SOUTH: SDL_GamepadButton
pub const SOUTH: SDL_GamepadButton
Bottom face button (e.g. Xbox A button)
pub const EAST: SDL_GamepadButton
pub const EAST: SDL_GamepadButton
Right face button (e.g. Xbox B button)
pub const WEST: SDL_GamepadButton
pub const WEST: SDL_GamepadButton
Left face button (e.g. Xbox X button)
pub const NORTH: SDL_GamepadButton
pub const NORTH: SDL_GamepadButton
Top face button (e.g. Xbox Y button)
pub const BACK: SDL_GamepadButton
pub const GUIDE: SDL_GamepadButton
pub const START: SDL_GamepadButton
pub const LEFT_STICK: SDL_GamepadButton
pub const RIGHT_STICK: SDL_GamepadButton
pub const LEFT_SHOULDER: SDL_GamepadButton
pub const RIGHT_SHOULDER: SDL_GamepadButton
pub const DPAD_UP: SDL_GamepadButton
pub const DPAD_DOWN: SDL_GamepadButton
pub const DPAD_LEFT: SDL_GamepadButton
pub const DPAD_RIGHT: SDL_GamepadButton
pub const MISC1: SDL_GamepadButton
pub const MISC1: SDL_GamepadButton
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)
pub const RIGHT_PADDLE1: SDL_GamepadButton
pub const RIGHT_PADDLE1: SDL_GamepadButton
Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1)
pub const LEFT_PADDLE1: SDL_GamepadButton
pub const LEFT_PADDLE1: SDL_GamepadButton
Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3)
pub const RIGHT_PADDLE2: SDL_GamepadButton
pub const RIGHT_PADDLE2: SDL_GamepadButton
Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2)
pub const LEFT_PADDLE2: SDL_GamepadButton
pub const LEFT_PADDLE2: SDL_GamepadButton
Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4)
pub const TOUCHPAD: SDL_GamepadButton
pub const TOUCHPAD: SDL_GamepadButton
PS4/PS5 touchpad button
pub const MISC2: SDL_GamepadButton
pub const MISC2: SDL_GamepadButton
Additional button
pub const MISC3: SDL_GamepadButton
pub const MISC3: SDL_GamepadButton
Additional button
pub const MISC4: SDL_GamepadButton
pub const MISC4: SDL_GamepadButton
Additional button
pub const MISC5: SDL_GamepadButton
pub const MISC5: SDL_GamepadButton
Additional button
pub const MISC6: SDL_GamepadButton
pub const MISC6: SDL_GamepadButton
Additional button
pub const COUNT: SDL_GamepadButton
Trait Implementations§
§impl Clone for SDL_GamepadButton
impl Clone for SDL_GamepadButton
§fn clone(&self) -> SDL_GamepadButton
fn clone(&self) -> SDL_GamepadButton
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Default for SDL_GamepadButton
impl Default for SDL_GamepadButton
§fn default() -> SDL_GamepadButton
fn default() -> SDL_GamepadButton
§impl From<SDL_GamepadButton> for i32
impl From<SDL_GamepadButton> for i32
§fn from(value: SDL_GamepadButton) -> i32
fn from(value: SDL_GamepadButton) -> i32
§impl Hash for SDL_GamepadButton
impl Hash for SDL_GamepadButton
§impl Ord for SDL_GamepadButton
impl Ord for SDL_GamepadButton
§fn cmp(&self, other: &SDL_GamepadButton) -> Ordering
fn cmp(&self, other: &SDL_GamepadButton) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for SDL_GamepadButton
impl PartialEq for SDL_GamepadButton
§impl PartialOrd for SDL_GamepadButton
impl PartialOrd for SDL_GamepadButton
impl Copy for SDL_GamepadButton
impl Eq for SDL_GamepadButton
impl StructuralPartialEq for SDL_GamepadButton
Auto Trait Implementations§
impl Freeze for SDL_GamepadButton
impl RefUnwindSafe for SDL_GamepadButton
impl Send for SDL_GamepadButton
impl Sync for SDL_GamepadButton
impl Unpin for SDL_GamepadButton
impl UnwindSafe for SDL_GamepadButton
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId
of Self
using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more