TSdlGamepadButton
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 TSdlGamepad.ButtonLabel.
Definition
Unit: Neslib.Sdl3.Input
type TSdlGamepadButton = (Invalid, South, East, West, North, Back, Guide, Start, LeftStick, RightStick, LeftShoulder, RightSoulder, DPadUp, DPadDown, DPadLeft...)
Enumeration Values
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
LeftStick = SDL_GAMEPAD_BUTTON_LEFT_STICK
RightStick = SDL_GAMEPAD_BUTTON_RIGHT_STICK
LeftShoulder = SDL_GAMEPAD_BUTTON_LEFT_SHOULDER
RightSoulder = SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER
DPadUp = SDL_GAMEPAD_BUTTON_DPAD_UP
DPadDown = SDL_GAMEPAD_BUTTON_DPAD_DOWN
DPadLeft = SDL_GAMEPAD_BUTTON_DPAD_LEFT
DPadRight = 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)
RightPaddle1 = SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1
Upper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1)
LeftPaddle1 = SDL_GAMEPAD_BUTTON_LEFT_PADDLE1
Upper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3)
RightPaddle2 = SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2
Lower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2)
LeftPaddle2 = SDL_GAMEPAD_BUTTON_LEFT_PADDLE2
Lower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4)
Touchpad = SDL_GAMEPAD_BUTTON_TOUCHPAD
PS4/PS5 touchpad button
Misc2 = SDL_GAMEPAD_BUTTON_MISC2
Additional button
Misc3 = SDL_GAMEPAD_BUTTON_MISC3
Additional button
Misc4 = SDL_GAMEPAD_BUTTON_MISC4
Additional button
Misc5 = SDL_GAMEPAD_BUTTON_MISC5
Additional button
Misc6 = SDL_GAMEPAD_BUTTON_MISC6
Additional button
Methods
Name | Description |
---|---|
FromString | Convert a string into a TSdlGamepadButton enum. |
ToString | Convert the enum to a string. |
Method Descriptions
FromString(String)
Convert a string into a TSdlGamepadButton enum.
This method is called internally to translate SDL gamepad mapping strings for the underlying joystick device into the consistent SDL gamepad mapping. You do not normally need to call this method unless you are parsing SDL gamepad mappings in your own code.
class function FromString(const AStr: String): TSdlGamepadButton; inline; static
Parameters
AStr
: String
: String representing a SDL gamepad button.
Returns
TSdlGamepadButton
: The TSdlGamepadButton enum corresponding to the input string, or Invalid
if no match was found.
See Also
ToString
Convert the enum to a string.
function ToString: String; inline
Returns
String
: A string for the given button, or an empty string if an invalid button is specified. The string returned is of the format used by SDL gamepad mapping strings.