; JoyX Example ; ------------ Graphics 640,480,0,2 SetBuffer BackBuffer() While Not KeyDown(1) Cls ; JoyX returns the stick's x-axis as a float from -1.0 (full ; left) to 1.0 (full right); JoyY is its vertical partner. jx#=JoyX() jy#=JoyY() If JoyType()=0 Then Text 0,0,"Esc: exit" Text 0,60,"No joystick detected - plug in a gamepad to try this example." Text 0,80,"With one attached, the crosshair below follows the stick." Else Text 0,0,"Move the stick left and right Esc: exit" End If ; Crosshair driven by the stick (sits centred with no input) x=320+jx*220 y=240+jy*180 Color 90,90,90 Line x,120,x,479 ; vertical marker tracks the JoyX value Color 255,255,0 Oval x-10,y-10,20,20,False Line x-14,y,x+14,y Line x,y-14,x,y+14 Color 255,255,255 Text 0,20,"JoyX() = "+jx Text 0,40,"JoyY() = "+jy Flip Wend End