rounded corner effect rounded corner effect

JavaScript Joystick Plug-in API

View the source of the examples to see most of this in use.

Methods

boolean setDevice(int gameDevice)
    Select the game device this instance of the control listens to; returns true if a controller is connected.
int getDevice()
    Returns the game device in use by this instance.
boolean isConnected()
    Test whether a game device is connected to the selected port.
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. Seting 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.
boolean hasZAxis()
    Does this device have a throttle control?
boolean hasRAxis()
    Does this device have a rudder control?
boolean hasPOV()
    Does this device have a 'hat switch'?
int getNumButtons()
    Returns the number of buttons on this device.
void setButtonA(int button)
    Sets which buton the 'a' property represents (from 1 to however many buttons the controller has).
void setButtonB(int button)
    Sets which buton the 'b' property represents (from 1 to however many buttons the controller has).
void calibrate()
    Lets the user calibrate an analogue device.
string getProductName()
    Returns the 31 character OEM name of the game device.

Properties

int x
    The game controller's x axis.
int y
    The game controller's y axis.
int z
    The game controller's throttle or z axis.
int r
    The game controller's rudder or r axis.
boolean a
    Button A pressed. Button A can be assigned to any of the controller's buttons.
boolean a
    Button B pressed. Button B can be assigned to any of the controller's buttons.
int buttons
    An integer representing the state of all the game controller's buttons as individual bits.
int pov
    The game controller's 'hat switch'. The value returned ranges from 0 to 35,900 (degrees multiplied by 100).
boolean up
    D-pad state for digital devices.
boolean down
    D-pad state for digital devices.
boolean left
    D-pad state for digital devices.
boolean right
    D-pad state for digital devices.

Embedding the control

<object id="player_1"
    classid="CLSID:3AE9ED90-4B59-47A0-873B-7B71554B3C3E"
    codebase="joystick.cab#version=0,5,0,1">
</object>

Back to introduction.

rounded corner effect rounded corner effect