This is my Ludum Dare 24 entry. Ludum Dare is a great 48h game programming competition. You should join it some time! :-)
This code was written in 48 hours and is pretty much just a big mess of hacks piled onto hacks, all based on hacks. It's hacks all the way down. It's ugly ugly ugly code.
Copyright 2012 by Richard Wossal richard@r-wos.org
Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.