F# and Monogame Part 2 – Android

Neil Danson's Blog

In my last post I showed how to get a Monogame Game class running on MacOS. This time it’s Android’s turn.

I’m going to assume you already have Xamarin Studio, the F# Android templates and Monogame installed.

Getting started

Create a new “Android Application” from under the F# Language tree node.

Add references to MonoGame.Framework.dll and Lindgren.Network.dll for Android. You’ll also need a reference to OpenTK (not 1.0).

Using the same Game definition from the MacOS tutorial –

type Game() as game =
    inherit Microsoft.Xna.Framework.Game() 
    let manager = new Microsoft.Xna.Framework.GraphicsDeviceManager(game)
    override __.Draw _ = game.GraphicsDevice.Clear Microsoft.Xna.Framework.Color.CornflowerBlue

In MainActivity.fs change the MainActivity to inherit from


And in the OnCreate member replace the content with

override this.OnCreate (bundle) = 
   base.OnCreate (bundle)

   Game.Activity <- this
   let game = new Game()

You should now see a lovely blue screen when running on an Android Device. I highly recommend owning an Android device for development as the emulators are rather slow….


View original post 69 more words


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s