Gamepad Action Library

Gamepad Action LibraryGameMaker has a number of dedicated actions that can be used to detect both analog and digital controls from multiple connected game pads. These actions require you to specify a gamepad index value, which is a number (counting from 0) that represents the gamepad being selected. Note that when a gamepad is plugged in to your device (or it is removed) then an asynchronous System Event is triggered (however to deal with this you may need to use code).

The gamepad "slots" are indexed from 0 with slots 0 - 3 inclusive being only for Xinput gamepads, ie: Xbox360 controllers and compatibles. However, you can also check slots 4 - 11 inclusive for DirectInput gamepads, which means you can detect many other models of controller when connected through these slots.

Input Constants

When working with the gamepad actions, input can come from axesbuttons or hats, which GameMaker will assign to the following built-in constants (note that "hats" are generally only detected on non-standard controllers):

Gamepad Button Constant
ConstantDescription
gp_face1Top button 1 (this maps to the "A" on an Xbox controller and the cross on a PS controller)
gp_face2Top button 2 (this maps to the "B" on an Xbox controller and the circle on a PS controller)
gp_face3Top button 3 (this maps to the "X" on an Xbox controller and the square on a PS controller)
gp_face4Top button 4 (this maps to the "Y" on an Xbox controller and the triangle on a PS controller)
gp_shoulderlLeft shoulder button
gp_shoulderlbLeft shoulder trigger
gp_shoulderrRight shoulder button
gp_shoulderrbRight shoulder trigger
gp_selectThe select button (on a PS controller, this triggers when you press the touchpad down)
gp_startThe start button (this is the "options" button on a PS controller)
gp_sticklThe left stick pressed (as a button)
gp_stickrThe right stick pressed (as a button)
gp_paduD-pad up
gp_paddD-pad down
gp_padlD-pad left
gp_padrD-pad right
gp_homeThe "home" button on Switch controllers, and the PS/XBOX logo buttons on some controllers
gp_touchpadbuttonThe touchpad button on a PS controller
gp_paddlerUpper or primary paddle, under your right hand (e.g. Xbox Elite paddle P1)
gp_paddlelUpper or primary paddle, under your left hand (e.g. Xbox Elite paddle P3)
gp_paddlerbLower or secondary paddle, under your right hand (e.g. Xbox Elite paddle P2)
gp_paddlelbLower or secondary paddle, under your left hand (e.g. Xbox Elite paddle P4)
gp_extra1An extra button that may be mapped to anything
gp_extra2An extra button that may be mapped to anything
gp_extra3An extra button that may be mapped to anything
gp_extra4An extra button that may be mapped to anything
gp_extra5An extra button that may be mapped to anything
gp_extra6An extra button that may be mapped to anything

To better understand exactly what part of the controller each constant represents, you can refer to the following image of a standard Xinput gamepad:

XInput Gamepad Configuration

Actions

The available gamepad actions are all listed below:

Gamepad Get Axis IconGet Gamepad Axis
Gamepad Get Trigger IconGet Gamepad Trigger
Gamepad Get Count IconGet Gamepad Count
Gamepad Get Connected IconGet Gamepad Connected
Gamepad Set Axis Deadzone IconSet Gamepad Axis Deadzone
Set Gamepad Button Threshold IconSet Gamepad Button Threshold
If Gamepad Button Pressed IconIf Gamepad Button Pressed
If Gamepad Button Down IconIf Gamepad Button Down
If Gamepad Button Released IconIf Gamepad Button Released

 

 

 

 

 

 

 

 

 

 

 

 

The following list shows current compatibility across the platforms (note that this will change with future updates):

sudo apt-get install jstest-gtk
sudo apt-get install joystick.