JavaScript API
The plug-in currently works with Firefox, IE, Opera and Safari on Windows, and Safari on OS X. The API is the same across all browsers.
Methods
| boolean | setDevice(int index) Select the game device the plug-in instance is connected to; returns true if a controller is connected. |
| int | getDevice() Returns the index of the game device currently set. |
| boolean | isConnected() Returns true if a controller is connected. |
| void | setAutoPoll(boolean autoPoll) Normally the device state is automatically polled every time a property is read, which may be too slow for the older analogue interface. Setting this to false only polls the device when a poll() is issued, and the property values are taken from that time. (It may also allow for better sync in longer game loops.) |
| void | poll() An explicit poll to the game device. |
| string | getProductName() Returns the OEM name of the game device. |
Properties
| int | x Joystick x-axis. |
| int | y Joystick y-axis. |
| int | z Throttle (or z-axis). |
| int | r Rudder (or r-axis). |
| int | u Joystick u-axis. |
| int | v Joystick v-axis. |
| boolean | a true if the A button is pressed (the A button can be reassigned to any of the controller's buttons) |
| boolean | b true if the B button is pressed (the B button can be reassigned to any of the controller's buttons) |
| int | buttons An integer representing the state of all the game controller's buttons as individual bits |
Embedding
For IE (or other ActiveX containers) the class ID is 3AE9ED90-4B59-47A0-873B-7B71554B3C3E. For all other browsers the MIME-type is application/x-vnd.numfum-joystick. Sample code to follow.