Skip to content

TSdlGamepadAxis

The list of axes available on a gamepad

Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX, and are centered within ~8000 of zero, though advanced UI will allow users to set or autodetect the dead zone, which varies between gamepads.

Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX (fully pressed) when reported by TSdlGamepad.Axis. Note that this is not the same range that will be reported by the lower-level TSdlJoystick.Axis.

Definition

Unit: Neslib.Sdl3.Input

type TSdlGamepadAxis = (Invalid, LeftX, LeftY, RightX, RightY, LeftTrigger, RightTrigger)

Enumeration Values

Invalid = SDL_GAMEPAD_AXIS_INVALID


LeftX = SDL_GAMEPAD_AXIS_LEFTX


LeftY = SDL_GAMEPAD_AXIS_LEFTY


RightX = SDL_GAMEPAD_AXIS_RIGHTX


RightY = SDL_GAMEPAD_AXIS_RIGHTY


LeftTrigger = SDL_GAMEPAD_AXIS_LEFT_TRIGGER


RightTrigger = SDL_GAMEPAD_AXIS_RIGHT_TRIGGER


Methods

Name Description
FromString Convert a string into a TSdlGamepadAxis enum.
ToString Convert the enum to a string.

Method Descriptions

FromString(String)

Convert a string into a TSdlGamepadAxis 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.

Note specially that "righttrigger" and "lefttrigger" map to TSdlGamepadAxis.RightTrigger and TSdlGamepadAxis.LeftTrigger, respectively.

class function FromString(const AStr: String): TSdlGamepadAxis; inline; static

Parameters

AStr: String : String representing a SDL gamepad axis.

Returns

TSdlGamepadAxis: The TSdlGamepadAxis 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 axis, or an empty string if an invalid axis is specified. The string returned is of the format used by SDL gamepad mapping strings.

See Also