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:

gleed-original

and here’s the new version:
new-annotated

 

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.

Handy use of extension method on a bool

I don’t like to overuse if/else statements.  I really dislike seeing code like this:

I just had an idea about using extension methods so I can write this instead:

and here’s the extension method:

Nice or not? I think it reads a bit better (for single line expressions anyway).