GetNumJoystickButtons

From Spheriki

Jump to: navigation, search

Finds the number of buttons detected on the given joystick.


Contents

Usage

number GetNumJoystickButtons(joy);
  • joy Number, non-negative. Index of joystick to check amount of buttons.


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.


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.


See also

Personal tools