SimpleExample using Boo

From SDL.NET

Boo Language Website (http://boo.codehaus.org)

This example is based on the SimpleExample.

Instructions

  • Have Boo (including booi) in your path.
  • Make sure the SdlDotNet.dll, Tao.Sdl.dll and Boo.Lang.dll are located in the same directory as the boo script.
  • Run 'booi SimpleExample.boo'

Code

  • Using SDL.NET 6.0.0
namespace SdlDotNet.Examples

import SdlDotNet.Graphics from SdlDotNet
import SdlDotNet.Core from SdlDotNet
import SdlDotNet.Input from SdlDotNet
import System
import System.Threading
import System.Drawing from System.Drawing

class SimpleExample():
	width = 640
	height = 480
	screen = Video.SetVideoMode(width, height)
	rand = Random()

	def KeyDown(sender, e as KeyboardEventArgs):
		if e.Key == Key.Escape:
			Events.QuitApplication()

	def Quit(sender, e as QuitEventArgs):
		Events.QuitApplication()

	def Tick(sender, e):
		screen.Fill(Color.FromArgb(rand.Next(255), rand.Next(255), rand.Next(255)))
		Thread.Sleep(100)
		screen.Update()

	def Run():
		Events.KeyboardDown += KeyDown
		Events.Tick += Tick
		Events.Quit += Quit
		Events.Fps = 5;
		Events.Run()

ex = SimpleExample()
ex.Run()