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
Constant Description
gp_face1 Top button 1 (this maps to the "A" on an Xbox controller and the cross on a PS controller)
gp_face2 Top button 2 (this maps to the "B" on an Xbox controller and the circle on a PS controller)
gp_face3 Top button 3 (this maps to the "X" on an Xbox controller and the square on a PS controller)
gp_face4 Top button 4 (this maps to the "Y" on an Xbox controller and the triangle on a PS controller)
gp_shoulderl Left shoulder button
gp_shoulderlb Left shoulder trigger
gp_shoulderr Right shoulder button
gp_shoulderrb Right shoulder trigger
gp_select The select button (on a PS controller, this triggers when you press the touchpad down)
gp_start The start button (this is the "options" button on a PS controller)
gp_stickl The left stick pressed (as a button)
gp_stickr The right stick pressed (as a button)
gp_padu D-pad up
gp_padd D-pad down
gp_padl D-pad left
gp_padr D-pad right

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 Icon Get Gamepad Axis
Gamepad Get Trigger Icon Get Gamepad Trigger
Gamepad Get Count Icon Get Gamepad Count
Gamepad Get Connected Icon Get Gamepad Connected
Gamepad Set Axis Deadzone Icon Set Gamepad Axis Deadzone
Set Gamepad Button Threshold Icon Set Gamepad Button Threshold
If Gamepad Button Pressed Icon If Gamepad Button Pressed
If Gamepad Button Down Icon If Gamepad Button Down
If Gamepad Button Released Icon If 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.