GameTools gameJoystick

From Wikiid
Jump to: navigation, search

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 () ; 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 :
plb_to_ac3d, mklevel, mktile, mktree, tiled, autogen_java, mk3dgallery
gameTools - File Formats :
title_screen.rgb, ultimate.xml, material.xml, decoration.xml, physics.xml
tiled.xml, tiled_autotiles.xml, Level files, Tile naming scheme, PLB files
gameTools - Source Code :
Game functions: gameCamera, gameClock, gameChecksum/gameHashTable, gameHTTP,
gameIsect, gameJoystick, gameParticleManager, gameScreen/gameMouse,
gameSky, gameStarter, gameStrokeFont, gameUtils
Material database: MatList/MatEntry
Tile map handling: TileObject/MapFlag/MapEntry/Map
Java Interfacing: JavaLink
Image file loading: liImage/liImageFactory
3D Model file loading: loadPLB, PLB exporter
Physics: Sabot, Bullet, gameTools - Use with Blender, PLB exporter
Object management: Object

Wikiid Pages relating to Lemur of Lima (edit)
Lemur of Lima - Main page
Lemur of Lima - Controls
Lemur of Lima - Levels :
List of Levels, Level design, Screen shots, Models
Lemur of Lima - Java Plugins :
Java plugin API, Event handling, Flags, GameInterface API , Alphabetical Index
Lemur of Lima - Source Code Documentation :
Initialisation, Main Loop, gameTools