; JoyWait Example ; --------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; JoyWait halts the program until a joystick button is pressed and ; returns its number. Draw an explanation frame BEFORE blocking - ; and never block at all when no joystick is attached, because the ; wait could then never end. Cls If JoyType()=0 Then Text 320,200,"No joystick detected - plug in a gamepad to try JoyWait.",True Text 320,220,"JoyWait would halt forever without one, so it is skipped.",True Else Text 320,200,"Press any joystick button to continue...",True End If Flip button=0 If JoyType()>0 Then button=JoyWait() ; blocks until a pad button is pressed While Not KeyDown(1) Cls Text 0,0,"Esc: exit" If button>0 Then Text 0,20,"JoyWait() returned button number "+button Else Text 0,20,"JoyWait() was skipped - no joystick attached." End If Flip Wend End