joystick_name(id);
Argument | Description |
---|---|
id | The id of the joystick (1 or 2). |
Returns: String
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.
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.