F# and Monogame Part 3 – iOS

In the previous instalment of of this mini-series I detailed how to make Monogame work on Android purely in F#. In this installment I tackle iOS. I’m going to assume you already have Xamarin Studio, the F# iOS templates and Monogame installed, as well as a valid iOS Developer licence.

Monogame on iOS in F# is actually trivial.

Go to new Project, select F#, select the target device (iPhone, iPad or Universal). Select Single View Application. Add references to MonoGame.Framework.dll and Lindgren.Network.dll for iOS.

Delete the *ViewController.fs file.

In AppDelegate.fs add the Game class definition from the previous 2 tutorials

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

and replace the FinishedLaunching member with the following

override this.FinishedLaunching (app, options) =
         let game = new Game()
         game.Run()
         true

Hey presto – the code should run fine. In fact running on iOS is easier than MacOS and Android.

Next time I’ll quickly cover a neat way to build content for Windows, Mac, Android and iOS easily. The pre-requisites are a valid XNA SDK install (which itself has a pre-requisite of VS2010).

Advertisements

About thedo666

Software developer trying to learn a new language - English!
This entry was posted in F#, iOS, Mono, Monogame and tagged , , . Bookmark the permalink.

4 Responses to F# and Monogame Part 3 – iOS

  1. Pingback: F# Weekly #31 2013 | Sergey Tihon's Blog

  2. Pingback: Xamarin Link Roundup – 6 Aug 2013 | Well Technically…

  3. Pingback: F# and Monogame Part 4 – Content Pipeline | Neil Danson's Blog

  4. Pingback: F# on Android

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s