$ filename "t.exe"
'uses rt32
'uses rtl64
uses window

indexbase 0

Sub SetFont(long 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 Box(int x,y,w,h,c)  
int iBrush
iBrush = CreateSolidBrush c
SelectObject bHdc, iBrush
Rectangle bHdc,x,y,w+x,h+y
DeleteObject iBrush
End Sub


Window "SineWave",600,240,2
SetFont 12,24,0,"courier"

int i
float px, py, px2, py2
float angle, angle2
float radius = 100
float frequency = 2
float frequency2 = 2
float x, x2

While AscKey=0 and WinExit=0
clsColor 0x7F,0x7F,0x7F
Circle Width*.125, 75, radius*.5, 0xFF,0xFF,0xFF
px = Width*.125 + cos(rad(angle))*(radius/2)
py = 75 + sin(rad(angle))*(radius/2)
Box px, py, 5, 5, 0
Line Width*.125, 75, px, py,4,0,0,0
angle2 = 0
For i=0 To Width
    px2 = Width*.125 + cos(rad(angle2))*(radius*.5)
    py2 = 75 + sin(rad(angle2))*(radius*.5)
    Pixel(Width*.125+radius*.5+i, py2,0)
    angle2 -= frequency2
Next 
Oval(Width*.125+radius*.5+x, py, 5,5, 0,0,0)
angle -= frequency
x+=1
iF x>= Width-60
   x = 0
   angle = 0
End iF
Line px, py, Width*.125+radius*.5+x, py,4,0,0,0
Text 0,185,"y = sin x", 0xFF,0xFF,0xFF  
Text 200,185,"px= " + trunc(px), 0xFF,0xFF,0xFF
Text 320,185,"py= " + trunc(py), 0xFF,0xFF,0xFF

Events
FlipBuffer
WaitFPS 60
Wend
WinEnd