joystick_name

Returns the name of the joystick.

Syntax:

joystick_name(id);


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


Returns: String


Description

This function will return a string with the name of the joystick/gamepad with the given id. If no such device is connected an empty string "" will be returned. 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)
   {
   j_name = joystick_name(1);
   }
else
   {
   j_name = "None";
   }

The above code checks to see if a joystick or gamepad is connected to the device and then sets a variable depending on the result of the check.


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