2010-02-10

My Second SmallBasic program

This one draws a sinus curve (well a cosinus curve):

GraphicsWindow.Title = "Hello World!"
GraphicsWindow.BackgroundColor = "Yellow"
GraphicsWindow.Width = 320
GraphicsWindow.Height = 200
GraphicsWindow.Show()

oldx = 0
oldy = Math.Cos(0) * 100 + 100

For x = 1 To 320
  y = Math.Cos(x/10) * 100 + 100
  GraphicsWindow.DrawLine(oldx,oldy,x,y)
  oldx = x
  oldy = y
EndFor

No comments:

Post a Comment