GLBasic User Manual

Main sections

GETJOYBUTTON

b% = GETJOYBUTTON(n%, m%)



This command returns the status of button m% for joystick number n%. This command set gives you the ability to access up to 10 joysticks (n%), each with up to 32 buttons (m%). The value returned will be 1 if the button is depressed, 0 if it is not.

NOTE : This command is only available to registered users.

<B>Button layout for GP2X/Wiz/Caanoo:</B>
Button0 = A
Button1 = B
Button2 = X
Button3 = Y
Button4 = TAT
Button5 = START/SELECT/MENU/HelpI (left button)
Button6 = SELECT/HOME/SELECT/HelpII (right button)
Button7 = VOL_DOWN
Button8 = VOL_UP
Button9 = FL
Button10= FR

The Caanoo will report VOL_UP and VOL_DOWN, when you press Home. The home button also triggers the ESC key.

Sample:
 
// ------------------------------------------------------------- //
// JOYSTICK DEMO II
// ------------------------------------------------------------- //

LOADFONT "minifont.bmp"

WHILE TRUE
FOR i=0 TO GETNUMJOYSTICKS()-1 // Get Number of Joysticks
PRINT GETJOYNAME$(i), 0, i*48 // Name of Device
a$="X:"+GETJOYX(i) + " Y:"+GETJOYY(i)+ " Z:"+ GETJOYZ(i) // XYZ-Position
a$=a$+"Rx:"+GETJOYRX(i) + " Ry:"+GETJOYRY(i)+ " Rz:"+GETJOYRZ(i) // XYZ-Rotation
FOR n=0 TO 31 // Up to 32 Buttons
a$=a$+" B"+n+":"+GETJOYBUTTON (i, n)
NEXT
PRINT a$, 0, i*48+16

// DIGI-Joystick
b$="DX:"+ GETDIGIX(i)+" DY:"+GETDIGIY(i)
PRINT b$, 0, i*48+32
NEXT
SHOWSCREEN
WEND

See also...