2010-02-10

My first SmallBasic program

Ok, my first was “Hello World”, but this is my first using the GraphicsWindow:

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

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

For i = 0.1 To 2 * Math.Pi Step 0.1
  x = Math.Sin(i) * 100 + 160
  y = Math.Cos(i) * 100 + 100
  GraphicsWindow.DrawLine(oldx,oldy,x,y)
  oldx = x
  oldy = y
EndFor

What does it do? It draws a circle. Great huh? Oh I could have used GraphicsWindow.DrawCircle? Amazing stuff :P

Btw SmallBasic may be downloaded from http://msdn.microsoft.com/en-us/devlabs/cc950524.aspx.

No comments:

Post a Comment