2D XNA Game Editor

This editor does a couple of neat things that XNA normally cannot do. First of all, it is a Windows Forms project, not an XNA project, because Windows Forms have so much built in functionality that XNA doesn’t have – from the basics, like an event listener for keys and mouse input, to more advanced templates for lists and file menus. It is a real challenge cramming an XNA window into a Windows Form, but luckily for any aspiring editor-creator, MSDN has a great tutorial on doing just that! Part two of the same tutorial shows how users can add images from disk while inside the program, instead of specifying content in the game’s solution explorer.

Further, I’ve added a TreeView in the top right corner that automatically shows any images inside the Content folder or any of its sub folders. A nice touch, because now I can simply create an image, save it to my content folder, and it’s automatically in the editor – no adding to a list or using a weird content file. The last thing that I implemented was a Save/Load feature. The editor saves to an XML document using the XMLSerializer class included in System.Xml.Serializer. This is a handy tool, as it saves and loads very easily to and from XML files. One annoyance: you cannot save multiple types with the XMLSerializer, so I used a wrapper class to allow me to save various objects.