joystick_buttons

Returns the number of buttons the joystick has.

Syntax:

joystick_buttons(id);


Argument Description
id The id of the joystick (1 or 2).


Returns: Real


Description

This function will return the number of buttons that the joystick/gamepad with the given id has, between 1 and 32. The id can be either 1 or 2 as GameMaker: Studio only accepts input from a maximum of two joysticks/gamepads.

NOTE: This function is only available for Windows.


Example:

if joystick_exists(1)
   {
   axes = joystick_buttons(1);
   }
else
   {
   axes = -1;
   }

The above code checks to see if a joystick or gamepad is connected to the device and then sets a variable to the number of buttons it has or -1 if none is connected.


Back: Joystick Input
Next: joystick_has_pov
© Copyright YoYo Games Ltd. 2018 All Rights Reserved