GLBasic User Manual

Main sections

GETJOYRZ

rz# = GETJOYRZ(n%)



For Joystick number n% it returns the amount of rotation from the rotation axis (if the joystick has one). What input this relates to on the joystick depends on the joystick driver - on a X-Box gamepad for example, the RX/RY/RZ values relate to the second analogue joystick.
The valid range for n% is 0-9 (maximum 10 joysticks), each with up to 32 buttons (m%). The value returned is in the range -1.0 to +1.0.

NOTE : This command is only available to registered users.
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...