Thursday, June 25, 2009
I like prototyping. Over the years I have gathered small pieces of code I seem to rewrite every time I land to a work environment. This is my first attempt at storing these interesting bits for other people to use too (and to save myself the trouble of finding the previous version from some half broken hard drive).
NanoSVG is simple and stupid SVG parser that does not need ay external libraries. Just blob the header and a source file into your project and your ready to enjoy vector paths! It is just enough that you can do all your level editing in Inkscape or Illustrator, hit save and play your new level.
I usually use colors to encode different things. For example red squares could be enemy spawn locations and green square the starting point of the player. If you need modifiers, just add outlines, so that red box with blue outline means a grunt with a SMG.
As you might have guessed my prototypes often look like geometry wars. I tend to use OpenGL to draw antialiased lines, points and some text. The point is to build something just enough to get validation or better insight to your ideas.
This version of the SVG parser is based on the Antigrain Geometry SVG example, and I wrote similar parser with Kimmo when I was working with Mountain Sheep.