Garry's Mod Wiki

JOYSTICK

Description

Enumerations used by input.IsButtonDown.

It's also part of the BUTTON_CODE enum.

Values

JOYSTICK_FIRST114
JOYSTICK_FIRST_BUTTON114Joystick buttons are in this range, but don't have individual enum names.
JOYSTICK_LAST_BUTTON145
JOYSTICK_FIRST_POV_BUTTON146Joystick POV buttons are in this range, but don't have individual enum names.
JOYSTICK_LAST_POV_BUTTON149
JOYSTICK_FIRST_AXIS_BUTTON150Joystick axis buttons are in this range, but don't have individual enum names.
JOYSTICK_LAST_AXIS_BUTTON161
JOYSTICK_LAST161

Example

A button configuration for a wireless controller.

local lx=input.GetAnalogValue(ANALOG_JOY_X) // Left X Axis: left -, right + local ly=input.GetAnalogValue(ANALOG_JOY_Y) // Left Y Axis: up -, bottom + local lr=input.GetAnalogValue(ANALOG_JOY_R) // Right X Axis: left -, right + local lu=input.GetAnalogValue(ANALOG_JOY_U) // Right Y Axis: up -, bottom + lx=lx/32768; ly=ly/32768; lr=lr/32768; lu=lu/32768; // Conversion to floats -1.0 - 1.0 local jA=input.IsButtonDown(114); // A Button local jB=input.IsButtonDown(115); // B Button local jX=input.IsButtonDown(116); // X Button local jY=input.IsButtonDown(117); // Y button local jL1=input.IsButtonDown(118); // L1 button local jL2=input.IsButtonDown(119); // R1 button local jPL=input.IsButtonDown(120); // Pause left local jPR=input.IsButtonDown(121); // Pause Right local jLAPD=input.IsButtonDown(122); // Left Analog Press down local jRAPD=input.IsButtonDown(123); // Right Analog Press down local jUp=input.IsButtonDown(146); // PAD BUTTONS ..... local jRight=input.IsButtonDown(147); // local jDown=input.IsButtonDown(148); // local jLeft=input.IsButtonDown(149); // local jLT=input.IsButtonDown(154); // Triggers local jRT=input.IsButtonDown(155); // // Obtain Mapping Enums // //for i=0,47 do // if(input.IsButtonDown(114+i)) then // print((i+114).." TRUE") // else // // end //end