gameGetJoystick(int N) returns a pointer to a gameJoystick class object for the N'th joystick or NULL if that joystick does not exist.
...defines the maximum number of joysticks that can be queried - currently this is set at two.
The gameJoystick structure for the N'th joystick is returned from gameGetJoystick(N). You can query the number of analog axes the joystick has - and ask whether it is actually plugged in using:
int gameJoystick::getNumAxes () ; bool gameJoystick::notWorking () ;
There may be between 1 and 32 buttons - you cannot query how many there are.
Whenever you wish to read the joystick, first call:
void gameJoystick::update () ;
...to read the physical device.
Then you query the state of the buttons using:
bool gameJoystick::isDown ( int which ) ; bool gameJoystick::isUp ( int which ) ;
unsigned int gameJoystick::getButtons () ; unsigned int gameJoystick::getJustDownButtons () ; unsigned int gameJoystick::getJustUpButtons () ;
The boolean functions query a single button given a number in the range 0 to 31, the 'unsigned int' functions return a packed bitfield with one bit per button.
To read the analog axes call:
float gameJoystick::getAxis ( int which_axis ) ;
...axes are numbered from zero upwards.
|Wikiid Pages relating to gameTools (edit)|
|gameTools - Main page|
|gameTools - Support Tools :|
|gameTools - File Formats :|
| gameTools - Source Code :
|Wikiid Pages relating to Lemur of Lima (edit)|
|Lemur of Lima - Main page|
|Lemur of Lima - Controls|
|Lemur of Lima - Levels :|
|Lemur of Lima - Java Plugins :|
|Lemur of Lima - Source Code Documentation :|