; WaitJoy Example ; --------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; WaitJoy halts the program until a joystick button is pressed and ; returns its number - a classic "press fire to start" pause. ; Draw the pause frame BEFORE blocking - and never block at all ; when no joystick is attached, or the wait could never end. Cls If JoyType()=0 Then Text 320,200,"No joystick detected - plug in a gamepad to try WaitJoy.",True Text 320,220,"WaitJoy would halt forever without one, so it is skipped.",True Else Text 320,200,"* G A M E P A U S E D *",True Text 320,220,"Press any pad button to resume",True End If Flip button=0 If JoyType()>0 Then button=WaitJoy() ; blocks until a pad button is pressed While Not KeyDown(1) Cls Text 0,0,"Esc: exit" If button>0 Then Text 0,20,"WaitJoy() returned button number "+button+" - game resumed!" Else Text 0,20,"WaitJoy() was skipped - no joystick attached." End If Flip Wend End