rem #####################################################
rem wave1
rem Copyright 2002 Marc Gale (Xalthorn)
rem #####################################################

gosub initialise
gosub mainloop
exit

rem #####################################################
label mainloop
 repeat
  gosub flipscreen
  clear window
  gosub drawbars
 until (1=2)
return

rem #####################################################
label drawbars
 for a=1 to maxbar
  bri=a/5+1
  p=barp(a)
  y=sines(p)
  x=a*10:xx=640-x
  col=bri*20+30
  setrgb 1,col,0,0
  setrgb 2,0,0,0
  setrgb 3,0,0,0
  gtriangle x,y to x,y-20 to xx,y-20
  gtriangle x,y to x,y+20 to xx,y+20
  setrgb 2,col,0,0
  gtriangle x,y to xx,y to xx,y-20
  gtriangle x,y to xx,y to xx,y+20

  p=p+2
  if p>360 p=p-360
  barp(a)=p
 next a
return

rem #####################################################
label flipscreen
 setdispbuf curbuf 
 curbuf=1-curbuf
 setdrawbuf curbuf
return

rem #####################################################
label initialise
 open window 640,512
 window origin "lb"

 dim sines(360)
 for a=0 to 360
  sines(a)=sin(a*(pi/180))*240+256
 next a

 maxbar=30
 dim barp(maxbar)
 for a=1 to maxbar
  barp(a)=a*6
  if barp(a)>360 barp(a)=barp(a)-360
 next a
return

