View Single Post
  #3 (permalink)  
Old 09-12-2007, 07:44 AM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 317
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
Here's an example in F# version 1.1.13.8 or Higher:

// An XNA game in F#

#light

#I @"Crogram FilesMicrosoft XNAXNA Game Studio Expressv1.0ReferencesWindowsx86"

#r "Microsoft.Xna.Framework.dll"
#r "Microsoft.Xna.Framework.Game.dll"

// Not all of these opens are required for this sample, but you will need them to write a full game

open Collections
open Compatibility
open Idioms
open Microsoft.Xna.Framework
open Microsoft.Xna.Framework.Audio
open Microsoft.Xna.Framework.Content
open Microsoft.Xna.Framework.Graphics
open Microsoft.Xna.Framework.Input
open Microsoft.Xna.Framework.Storage
open System
open System.IO

type MyGame = class
inherit Game as base

val mutable graphics : GraphicsDeviceManager

new() as this =
{
graphics = null
}
then
this.graphics <- new GraphicsDeviceManager(this)

override this.Draw(gameTime) =
let gd = this.graphics.GraphicsDevice
gd.Clear(Color.Green)

end

let main() =
let game = new MyGame()
game.Run()

[<STAThread>]
do main()
Reply With Quote