Announcing a new version of the Gleed 2D XNA tool

I’ve spent some time over the Summer and Autumn of 2011 rewriting the Gleed 2D tool.  This is a tool for editing levels for 2D games and is a very popular tool in the XNA community for games running on XBox and Windows Phone.

Most of the changes in the new version are under-the-hood.  The biggest change has been to make it have a plug-in architecture.  There has also been a few UI changes though; here’s some screen-shots.

The original tool before being re-written:


and here’s the new version:


The main reason for rewriting the tool was that I wanted to add more features to it but found that it wasn’t easy.  It wasn’t easy because it was originally written to just handle the basics needed for creating and editing levels.

The features that I wanted to add were for the next version of my game (video here). I wanted to include lighting and shadows and  I wanted to design these on the canvas.

Instead of shoe-horning my changes into the original Gleed 2D source, I decided it’d be best to rewrite it and change it to a plug-in based tool.

So, now everything is a plug-in.  The basic shapes (rectangle, circle, path) and textures are now plug-ins.  Lighting (lights and shadows) is now a plug-in.  There’s also a plug-in for simple ‘behaviour’.

Here’s a quick video showing how to use the basic shapes and textures:

Basic shapes and textures

Here’s a short video showing lighting:

Lights and shadows

and lastly, here’s a short video showing simple behaviours:

Simple behaviours

The tool is still currently a bit rough.  There’s various bugs that need to be fixed, but none of them stop the tool from doing what it was designed to do.  The project is now quick big, so I’m hoping that the community will jump in and add/fix stuff.  I’d like to see plug-ins for physics and particle systems.

Feel free to download the source and play around.

A fast way of converting C# enums to strings–and back again.

I recently needed a fast way of converting lots of enums to strings (and back again).  I needed to do it very quickly.  ‘Enum.Parse’ just wasn’t fast enough.

I discovered there was no ‘enum mapper’ in C#, so I knocked up this little class.  It uses reflection just once when it comes across a new enum.

It’s compatible with .NET 3.5 too.

Updated: Code Formatter Plugin for Windows Live Writer

This plug-in formats and highlights code. Version can be downloaded here. Keep reading for more info.

As well as a few bug fixes, this release includes the following features:

· Use different formatting engines such as ActiPro (Insert formatted code), and SyntaxHighlighter (Insert highlighted code)
· Dozens of languages, including PowerShell, MSIL, Pascal and XAML
· Live formatting of code using the superb ActiPro code editor.  ActiPro very kindly donated the license.
· The ability to output either highlighted text (html) or an image
· WordPress support for the SyntaxHighlighter Evolved plugin

This plugin adds four tools in WLW’s tool window:


Tool 1) Code as bitmap

This uses the ActiPro formatting engine to take a snapshot of the code.

You’ll see this screen when clicked – if there’s text in the clipboard, it’ll be shown here, or you can copy and paste when the window appears:


This srceen allows you to set the size of the editor window.  You can either select common widths from the drop-down or put in your own width – for instance, 465 is the ideal width for my template on Blogger.  The buttons on the bottom right allow you to then:

a) insert the image straight into the blog post or
b) have the plugin copy the image or
c) discard it.

The advantage of the option A is that the code is still editable in WLW; the disadvantage – you cannot [yet] apply bitmap effects, such as reflection or drop shadow.

The advantage of option B is that you can apply bitmap effects, but the disadvantage is that code will no longer be editable.

Tool 2) Formatted code

This also uses uses the ActiPro formatting engine.

When inserting code, the plugin window will allow various properties of the code to be changed:


When clicking edit code, you’ll see the edit source code screen:


Tool 3) Highlighted code

This uses the Syntax Highlighter formatting engine.  When inserting code, the edit screen will appear in the same way as when you insert formatted code (see above).  The only difference is a ‘show preview’ button, which displays this preview window:

To use the SyntaxHighlighter engine, ensure your blog is correctly set-up.  For the preview window to correctly display your code, ensure the Settings are correct.  Here’s the Settings window:

Tool 4) WordPress Formatted

This changes the HTML output to that expected by theSyntaxHighlighter Evolved plugin for WordPress.  It’s very similar to using the SyntaxHighlighter engine, but you don’t need to worry about setting up your blog with the correct scripts.  Do be aware though, that for the Preview window to work correctly, you still need to set-up this plugin so that it knows where the SyntaxHighlighter brushes and scripts are (the default settings work right now, but if Alex changes the location in the future, you’ll need to update the settings).

To see examples of the output, please see this blog post.

Version can be downloaded here.  To use it, extract the binaries to Program FilesWindows LiveWriterPlugins and run WLW.  If you’re using a version of WLW prior to Beta 3, then you need to remove it and update!  (Alternatively, change the directory to Program FilesWindows Live WriterPlugins)

Thanks again to all those that left feedback.   Please keep it coming. Hopefully, the bugs that have been reported have now been fixed.