Class | Rubygame::Joystick |
In: |
ext/rubygame/rubygame_shared.c
|
Parent: | Object |
The Joystick class interfaces with joysticks, gamepads, and other similar hardware devices, commonly used to play games. Each joystick can offer 0 or more axes, balls, hats, and/or buttons.
After a Joystick object is successfully created, events for that Joystick will begin appearing on the Queue, reporting any state change that occurs. Some examples of state changes are a button being pressed or released, or a control stick being moved (resulting in one or more axes being changed).
The full list of Joystick-related events is as follows:
In future versions of Rubygame, it will be possible to directly query the state each joystick. However, it is recommended that you use the event system for most cases, so you might as well get used to it!
Create and initialize an interface to the nth joystick on the system. Raises SDLError if the joystick could not be opened.