Patrick Godwin's Blog-O-Rama!

Developers, developers, developers!

MonoGame: XNA for Metro Style apps

As most of you may know, XNA is not supported as an option for Windows 8 Metro Style apps. As a result, those who use C# for game development have very few options with Metro Style apps. Wondering what alternatives there are to XNA, I did some scrounging around the internet to discover that MonoGame, an open source game development framework developed alongside Mono, was working on a Windows 8 branch of their technology. This is a great find for any C# developers looking to write games on Windows 8. So here is what you need to do to start porting your XNA games to Windows 8:

Prerequisites:

Windows 8 Release Preview
Visual Studio 2012 Release Candidate
MonoGame Template for Metro Style apps
MonoGame Binary (Built 6/7/2012 for your convenience)

Instructions:

Once you have installed and downloaded the required materials, we can get started. First thing you need to do is extract the MonoGame Template for Metro Style apps attached above to the folder

“%UserProfile%\My Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#\”

like so:

image

Next, you can open Visual Studio and create a MonoGame Metro Style app, like so:

image

Now that you’ve created the project, you simply have to add a reference to MonoGame.Framework.Windows8.dll, located in MonoGame.zip:

image

Once that is complete, all of the errors should go away and the app should build without any problems. You’ll recognize the familiar cornflower blue background, except now it’s running as a Metro Style app!

image

Conclusion:

From here, the MonoGame APIs appear to be one to one with the XNA APIs. The only thing to note that, as of this posting, MonoGame for Windows 8 is still lacking support for the Audio and Effects API. That will soon be fixed, and a follow up post will be published.

Keep an eye out for the stable release of MonoGame for Windows 8 by checking the MonoGame GitHub and Codeplex pages in the next few weeks. Until then, you can always build from the Develop3D Branch.

4 Responses to “MonoGame: XNA for Metro Style apps”

  1. Great man, good job!
    When I got an app I´ll post it.

    Comment by Kato — July 18, 2012 @ 3:20 pm

  2. I Get an Exception, as it following the above, My Empty prpjetc builds and runs forst time OK. But subsequent runs reveals The following exceptions being raised:

    HRESULT: [0x887A0004], Module: [SharpDX.DXGI], ApiCode: [DXGI_ERROR_UNSUPPORTED/Unsupported], Message: The specified device interface or feature level is not supported on this system.

    I don’t really understand this, but it was searching for Result.cs and MetroFrameworkView.cs’. under \Patrick\ Documents, as indicated by the following Stack Trace

    Locating source for ‘c:\Users\Patrick\Downloads\mono-MonoGame-2.1.0.0-1379-gf639074\mono-MonoGame-f639074\MonoGame.Framework\Windows8\MetroFrameworkView.cs’. Checksum: MD5 {96 f8 a6 ea dc 79 bd 40 4e 17 8b f9 c1 46 67 f0}
    The file ‘c:\Users\Patrick\Downloads\mono-MonoGame-2.1.0.0-1379-gf639074\mono-MonoGame-f639074\MonoGame.Framework\Windows8\MetroFrameworkView.cs’ does not exist.
    Looking in script documents for ‘c:\Users\Patrick\Downloads\mono-MonoGame-2.1.0.0-1379-gf639074\mono-MonoGame-f639074\MonoGame.Framework\Windows8\MetroFrameworkView.cs’…
    Looking in the projects for ‘c:\Users\Patrick\Downloads\mono-MonoGame-2.1.0.0-1379-gf639074\mono-MonoGame-f639074\MonoGame.Framework\Windows8\MetroFrameworkView.cs’.
    The file was not found in a project.
    Looking in directory ‘H:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\’…
    Looking in directory ‘H:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\vccorlib\’…
    Looking in directory ‘H:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\’…
    Looking in directory ‘H:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl\’…
    Looking in directory ‘H:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include’…
    The debugger could not locate the source file ‘c:\Users\Patrick\Downloads\mono-MonoGame-2.1.0.0-1379-gf639074\mono-MonoGame-f639074\MonoGame.Framework\Windows8\MetroFrameworkView.cs’.

    Comment by Jules — July 29, 2012 @ 11:18 am

  3. I dont know how to Load Content to game

    Comment by Long Pham — August 7, 2012 @ 6:36 am

  4. isnt a stable release of monogame for windows 8 released?? if it is, can you post a similar blog about how to…
    thanks

    Comment by sanjan — August 10, 2012 @ 2:16 pm

RSS feed for comments on this post. TrackBack URL

Leave a Response