FlixelGamepadButton
View sourceclass
org.flixelgdx.input.gamepad.FlixelGamepadButton
Logical gamepad button and axis identifiers for FlixelGamepadInputManager, resolved to native indices through each Controller.getMapping() (gdx-controllers SDL-style layout).
Important Note for Desktop (LWJGL3) vs Web (TeaVM)
On LWJGL3, gdx-controllers-desktop uses SDL with a large controller database, so many USB pads are remapped to the same logical layout. On web, gdx-controllers-teavm reads the browser Gamepad API and always exposes the W3C standard face-button indices (south, east, west, north) through a fixed ControllerMapping. If a device reports non-standard button ordering but the browser still labels the mapping as standard (or the hardware wires two actions to overlapping reports), logical A and Y can disagree with what you see on desktop for the same physical pad. That is a platform and driver limitation, not something logicalButtonToNative can infer without per-device tables. Games that need perfect parity can offer a remap screen or branch on Application.getType() and Controller.getName().
Fields
NONE
ANY
A
B
C
X
Y
Z
L1
R1
L2
R2
THUMBL
THUMBR
START
SELECT
MODE
CIRCLE
DPAD_UP
DPAD_DOWN
DPAD_LEFT
DPAD_RIGHT
AXIS_LEFT_X
AXIS_LEFT_Y
AXIS_RIGHT_X
AXIS_RIGHT_Y
AXIS_TRIGGER_L
AXIS_TRIGGER_R
Methods
logicalButtonToNative(Controller, int)
Resolves a logical button code to the native button index for the given controller.
Parameters:
| Name | Description |
|---|---|
controller | Controller whose Controller.getMapping() is used. |
logicalButton | Value from this class, except FlixelGamepadButton.ANY and FlixelGamepadButton.NONE. |
Returns: Native index, or ControllerMapping.UNDEFINED when unsupported.
logicalAxisToNative(Controller, int)
Resolves a logical axis constant to the native axis index for the given controller.
Stick axes (FlixelGamepadButton.AXIS_LEFT_X, FlixelGamepadButton.AXIS_LEFT_Y, FlixelGamepadButton.AXIS_RIGHT_X, FlixelGamepadButton.AXIS_RIGHT_Y) are resolved through the controller's ControllerMapping. Trigger axes (FlixelGamepadButton.AXIS_TRIGGER_L, FlixelGamepadButton.AXIS_TRIGGER_R) return fixed SDL ordinals (4 and 5) because ControllerMapping has no axis fields for triggers; this is only meaningful on the Jamepad/SDL desktop backend.
Parameters:
| Name | Description |
|---|---|
controller | Controller whose Controller.getMapping() is used. |
logicalAxis | One of the AXIS_* constants in this class. |
Returns: Native axis index, or ControllerMapping.UNDEFINED when unsupported.
fromString(String)
Resolves a button name to a logical button code.
Parameters:
| Name | Description |
|---|---|
name | Human-readable name (case-insensitive), for example "A" or "START". |
Returns: A logical code from this class, or Keys.UNKNOWN when not recognized.
toString(int)
Returns a readable English name for a logical button code.
Parameters:
| Name | Description |
|---|---|
logicalButtonCode | Value from this class. |
Returns: Description, or "?" when unknown.