
indexbase 0
Include "window.inc"

Sub SetFont(sys width, height, flag, string font)  
sys hFont
hFont = CreateFont height,width,0,0,flag,0,0,0,0,0,0,0,0,font
SelectObject bHdc, hFont
SetBkMode bHdc,1
DeleteObject hFont
End Sub

Sub SetText(string txt, sys x, y, color) 
SetTextColor bHdc, color
TextOut bHdc,x,y,txt,Len(txt)
End Sub

Sub Circle(int x,y,r,c)       
int iBrush,iPen
iBrush = CreateSolidBrush c
iPen=CreatePen -1,-1,c
SelectObject bHdc, iBrush
SelectObject bHdc, iPen
Ellipse bHdc,x,y,x+r*2,y+r*2
DeleteObject iBrush
DeleteObject iPen
End Sub

Sub WaitFrames(sys Frame)    
QueryPerformanceFrequency sys_Freq                                                                                          
sys_Interval = sys_Freq/Frame  
do                                                                       
QueryPerformanceCounter sys_cT2                                                 
iF sys_cT2 >= sys_cT1 + sys_Interval                                             
QueryPerformanceCounter sys_cT1                                              
Exit Sub            
End iF
end do                                                                             
End Sub


Window "Window",640,480,1 
SetFont 18,48,0,"times"

int x,y
While AscKey=0 and WinExit =0
  ClsColor 0,200,200
  For y=0 To 480 step 20
    For x=0 To 640 step 20
      Circle x,y,20, ColorRgb 10,Rand(180,200),Rand(180,255)
    Next
  Next
  SetText "This is a water 3D effect",100,8,0xF8F880    
  Events
  FlipBuffer
  WaitFrames 10
Wend
WinEnd