indexBase 0
include "window.inc"


Sub WaitFrames(sys Frame)    
QueryPerformanceFrequency sys_Freq                                                                                          
sys_Interval = sys_Freq/Frame  
While (1)                                                                       
QueryPerformanceCounter sys_cT2                                                 
iF sys_cT2 >= sys_cT1 + sys_Interval                                             
QueryPerformanceCounter sys_cT1                                              
Exit Sub            
End iF
Wend                                                                             
End Sub


Window "Puls",640,480,1
single vel, xOff, yOff, a, angle
int r,g,b,rc,gc,bc
rc=0xc8
gc=0xc8
bc=0xf8
r=255
g=0
b=0

clsColor rc,gc,bc
While WinExit=0
 if key(82)<>0 then r=r+1 : r and=255
 if key(71)<>0 then g=g+1 : g and=255
 if key(66)<>0 then b=b+1 : b and=255
 iF MouseButton=1
    angle +=10
    vel= cos(rad(angle)) * 6
    For a=0 To 360 Step 30 '75
        xoff= cos(rad(a)) * vel
        yoff= sin(rad(a)) * vel
        Oval xmouse + xoff, yMouse + yoff, vel, vel, r,g,b 
        'Oval xMouse, yMouse, 2, 2, 0xff,0xff,0xff
    Next
  End iF  
iF MouseButton=2 Then clsColor rc,gc,bc
Events
FlipBuffer
WaitFrames 34
Wend
WinEnd