GetNumJoystickButtons
From Spheriki
Finds the number of buttons detected on the given joystick.
Contents |
[edit]
Usage
number GetNumJoystickButtons(joy);
- joy Number, non-negative. Index of joystick to check amount of buttons.
[edit]
Examples
var num_joys = GetNumJoysticks();
if (num_joys > 0)
{
var joy_info = "";
for (var i = 0; i < num_joys; ++i)
joy_info = "joystick #" + i + " has " + GetNumJoystickButtons(i) + " button(s).\n";
Abort(joy_info);
}
else
Abort("Huh? No joysticks.");
The above code will display the number of joysticks found, and how many buttons were detected on each.
[edit]
Notes
- Use the GetNumJoysticks() function to find the valid range of the argument
joy.
- Many players will not have access to a joystick, so joystick input should be provided as an alternative to keyboard or mouse input, rather than a substitute.
[edit]
See also
- Abort()

