GLBasic User Manual

Main sections

GETJOY...()


n% = GETNUMJOYSTICKS( )
n$ = GETJOYNAME$(n%)
x# = GETJOYX(n%)
y# = GETJOYY(n%)
z# = GETJOYZ(n%) // Throttle
rx# = GETJOYRX(n%)
ry# = GETJOYRY(n%)
rz# = GETJOYRZ(n%)
b% = GETJOYBUTTON(n%, m%)
dx# = GETDIGIX(n%) // Hat switch
dy# = GETDIGIY(n%)




This command set gives you the ability to access up to 10 joysticks (n%), each with up to 32 buttons (m%). This command is only available to registered users.

<B>Buttonlayout for GP2X:</B>
Button0 = A
Button1 = B
Button2 = X
Button3 = Y
Button4 = TAT
Button5 = START
Button6 = SELECT
Button7 = VOL_DOWN
Button8 = VOL_UP
Button9 = FL
Button10= FR


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...