; Flip Example ; ------------ Graphics 640,480,0,2 SetBuffer BackBuffer() vwait=1 frames=0 fps=0 timer=MilliSecs() x#=0 While Not KeyDown(1) ; Space toggles Flip's vwait parameter If KeyHit(57) Then vwait=1-vwait ; A ball drifting across the screen x=x+3 If x>640 Then x=-40 Cls Color 0,200,255 Oval x,220,40,40,1 ; Count how many frames we manage per second frames=frames+1 If MilliSecs()-timer>=1000 Then fps=frames frames=0 timer=MilliSecs() EndIf Color 255,255,255 Text 0,0,"Space: toggle vwait Esc: exit" Text 0,20,"Flip "+vwait+" ("+fps+" frames per second)" Text 0,40,"vwait=1 syncs to the monitor refresh; vwait=0 flips flat out" ; Flip shows the finished back buffer on screen Flip vwait Wend End