#[repr(transparent)]pub struct SDL_GamepadButton(pub c_int);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 GameCube controllers this would be A/X/B/Y, 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)
| Associated constant | Global constant | Description |
|---|---|---|
INVALID | SDL_GAMEPAD_BUTTON_INVALID | |
SOUTH | SDL_GAMEPAD_BUTTON_SOUTH | Bottom face button (e.g. Xbox A button) |
EAST | SDL_GAMEPAD_BUTTON_EAST | Right face button (e.g. Xbox B button) |
WEST | SDL_GAMEPAD_BUTTON_WEST | Left face button (e.g. Xbox X button) |
NORTH | SDL_GAMEPAD_BUTTON_NORTH | Top face button (e.g. Xbox Y button) |
BACK | SDL_GAMEPAD_BUTTON_BACK | |
GUIDE | SDL_GAMEPAD_BUTTON_GUIDE | |
START | SDL_GAMEPAD_BUTTON_START | |
LEFT_STICK | SDL_GAMEPAD_BUTTON_LEFT_STICK | |
RIGHT_STICK | SDL_GAMEPAD_BUTTON_RIGHT_STICK | |
LEFT_SHOULDER | SDL_GAMEPAD_BUTTON_LEFT_SHOULDER | |
RIGHT_SHOULDER | SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER | |
DPAD_UP | SDL_GAMEPAD_BUTTON_DPAD_UP | |
DPAD_DOWN | SDL_GAMEPAD_BUTTON_DPAD_DOWN | |
DPAD_LEFT | SDL_GAMEPAD_BUTTON_DPAD_LEFT | |
DPAD_RIGHT | SDL_GAMEPAD_BUTTON_DPAD_RIGHT | |
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) |
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) |
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) |
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) |
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) |
TOUCHPAD | SDL_GAMEPAD_BUTTON_TOUCHPAD | PS4/PS5 touchpad button |
MISC2 | SDL_GAMEPAD_BUTTON_MISC2 | Additional button |
MISC3 | SDL_GAMEPAD_BUTTON_MISC3 | Additional button (e.g. Nintendo GameCube left trigger click) |
MISC4 | SDL_GAMEPAD_BUTTON_MISC4 | Additional button (e.g. Nintendo GameCube right trigger click) |
MISC5 | SDL_GAMEPAD_BUTTON_MISC5 | Additional button |
MISC6 | SDL_GAMEPAD_BUTTON_MISC6 | Additional button |
COUNT | SDL_GAMEPAD_BUTTON_COUNT |
Tuple Fields§
§0: c_intImplementations§
Source§impl SDL_GamepadButton
impl SDL_GamepadButton
pub const INVALID: Self
pub const BACK: Self
pub const GUIDE: Self
pub const START: Self
pub const LEFT_STICK: Self
pub const RIGHT_STICK: Self
pub const LEFT_SHOULDER: Self
pub const RIGHT_SHOULDER: Self
pub const DPAD_UP: Self
pub const DPAD_DOWN: Self
pub const DPAD_LEFT: Self
pub const DPAD_RIGHT: Self
Sourcepub const MISC1: Self
pub const MISC1: Self
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)
Sourcepub const RIGHT_PADDLE1: Self
pub const RIGHT_PADDLE1: Self
Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1, DualSense Edge RB button, Right Joy-Con SR button)
Sourcepub const LEFT_PADDLE1: Self
pub const LEFT_PADDLE1: Self
Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3, DualSense Edge LB button, Left Joy-Con SL button)
Sourcepub const RIGHT_PADDLE2: Self
pub const RIGHT_PADDLE2: Self
Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2, DualSense Edge right Fn button, Right Joy-Con SL button)
Sourcepub const LEFT_PADDLE2: Self
pub const LEFT_PADDLE2: Self
Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4, DualSense Edge left Fn button, Left Joy-Con SR button)
pub const COUNT: Self
Trait Implementations§
Source§impl Clone for SDL_GamepadButton
impl Clone for SDL_GamepadButton
Source§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 moreSource§impl Debug for SDL_GamepadButton
Available on crate feature debug-impls only.
impl Debug for SDL_GamepadButton
debug-impls only.Source§impl Default for SDL_GamepadButton
impl Default for SDL_GamepadButton
Source§fn default() -> SDL_GamepadButton
fn default() -> SDL_GamepadButton
Source§impl From<SDL_GamepadButton> for c_int
impl From<SDL_GamepadButton> for c_int
Source§fn from(value: SDL_GamepadButton) -> Self
fn from(value: SDL_GamepadButton) -> Self
Source§impl GroupMetadata for SDL_GamepadButton
Available on crate feature metadata only.
impl GroupMetadata for SDL_GamepadButton
metadata only.