So, we are a couple of months into 2012 so I thought it was time to post an update on developing with MonoDevelop and specifically using the open source MonoGame project to develop for the iPad.
Before I start writing ‘the next Angry Birds’ I decided to start with something much easier – a simple paint application – and so that is what this blog post is about!
If you just want to see the results then jump straight to the bottom of this page where you can watch a time lapse video of the application being used on an iPad simulator. Otherwise continue below for details of the code and my early thoughts on MonoGame…
For full details of MonoGame head over to CodePlex, however basically the idea is that you should be able to develop something that can run on multiple platforms without having to make too many changes to the code.
I am developing on the Mac, using MonoDevelop and targeting the iPad. To get started you need a copy of the MonoGame library, which can be forked/cloned from GitHub.
Fire up MonoDevelop, start a new MonoTouch project and add references to the MonoGame project.
Within a few minutes you should be able to get something very simple appearing on the iOS simulator…
- Add a new class which derives from the MonoGame Game class.
- Ensure a GraphicsDeviceManager is created.
- Override the Draw method and insert your rendering code.
…and bish bash bosh, there you go – you have something appearing on screen in no time at all.
Ok, so if you don’t put any code in your Draw method then you just get a ‘nice’ magenta screen but what do you expect for approximately 10 lines of code!
To implement something like the iPaint app you will need to do a bit more however I’ve found using MonoGame relatively simple and pain free. The only ‘unknown’ at the moment is I don’t know what the licensing situation is – i.e. If (in the highly unlikely event) I develop ‘the next Angry Birds’ and became a billionaire would I owe some ‘MonoGame people’ lots of money?
Coming to an App Store near you – probably no time soon…
So, are you going to see iPaint in the app store – errr, no – well, not released by me you won’t. I don’t intend to pay $99 a year for my Apple developers license until I’ve written something more worthwhile – and of course on top of that is the $400 MonoDevelop license which is required in order to run the software on a real iPad and not a simulator. Plus, considering you can buy the most excellent InspirePro for less than a dollar I don’t think that my iPaint app is really going to compete!
So, what next?
So, what next, I hear you say. Well, the intention is still to develop a game for the iPad and publish it to the App Store – Development will be starting on that shortly. The question is do I want to use MonoGame or just use standard MonoTouch. This is something that I will need to look into further. Certainly the advantage of MonoGame is that it works very well and has been very easy to use – Also, in theory, porting any game I write to another platform (e.g. WP7) should be easy(ish) – If I want to do that. Are there any disadvantages? The fact it is open source might concern some people – however my experience so far is that it has been very stable – and certainly it has an active community updating it all the time. So, assuming licensing is to my liking I like the idea of using MonoGame – and if I can support the MonoGame community with updates then even better.
iPaint in Action
So, that just about rounds things up for this post. Details of where you can get the MonoGame source and indeed the iPaint source are detailed below.
Also here is a video (one hour condensed into one minute) showing the iPaint app running on the iOS simulator – and my attempt at reproducing Claude Monet’s ‘The Manneporte near Étretat’. Enjoy.
- Details of MonoGame are on CodePlex.
- The MonoGame source code is available on GitHub.
- A copy of the iPaint source code is also on GitHub.
- MonoDevelop can be found here