; JoyU Example ; ------------ Graphics 640,480,0,2 SetBuffer BackBuffer() While Not KeyDown(1) Cls ; JoyU returns the stick's first extra slider as a float from ; -1.0 to 1.0 - on flight sticks this is often the throttle. ; JoyV reads the second slider the same way. u#=JoyU() v#=JoyV() If JoyType()=0 Then Text 0,0,"Esc: exit" Text 0,60,"No joystick detected - plug in a stick with a throttle slider." Text 0,80,"With one attached, the throttle gauge follows the U slider." Else Text 0,0,"Move the throttle/slider Esc: exit" End If ; A throttle gauge for each slider, filling from the centre For g=0 To 1 gx=260+g*90 If g=0 Then value#=u Else value#=v Color 90,90,90 Rect gx,140,50,240,False Line gx,260,gx+50,260 ; centre (value 0) mark Color 255,220,0 If value>0 Then Rect gx+2,260-value*118,46,value*118 If value<0 Then Rect gx+2,261,46,-value*118 Color 255,255,255 If g=0 Then Text gx+25,390,"U",True Else Text gx+25,390,"V",True Next Text 0,20,"JoyU() = "+u Text 0,40,"(JoyV() = "+v+")" Flip Wend End