So, I’ve gotten out of my whining-about-politics rut to do something entirely new and original on this blog… well, once I get finished on my coding revamp not new and original at all as I intend to do it a lot more often. What is this new and original thing you ask? Well, I’ve been messing around with SDL recently and I’ve whipped up a version of Pong which you should be able to find here to download. Pong is pretty much the simplest game ever, and after a lot of experimentation with various versions of it to teach myself SDL I’ve reached a stage where it’s all come together in a fairly nice, albeit basic fashion.
The code is contained in a .tar.gz archive file, and if you’re on a Unix (Linux/BSD/Mac OS X or something like HP-UX if you’re really exotic) you should have the tools to extract it, and on Windows something like the excellent 7-Zip should be able to handle it (seriously, don’t use the built-in Windows tools… they’re wack).
It’s pretty basic, although it’s got AI included should you wish to play the computer that can be activated through a bit of commenting and a rebuild. In order to get it up and running, you’ll need a C++ compiler (g++ and Clang work fine, so should Visual Studio) and the SDL, SDL_image and SDL_ttf libraries installed on your computer. If you’re using a Unix it’s pretty straightforward to compile – just use gunzip and tar to extract it to a directory, and the makefile should do the rest: for those of you new to this, typing “make” at the command line should get it running. Type “make clean” to remove the executable and all files if you want to get rid of it.
I work mainly in Linux these days, but I’m going to test it out on Windows at some point in the future. I’d imagine that adding all of the source files to a Visual Studio project should do the trick, and make sure that the TTF font and image files are in the same directory as the .vcproj file… also in my experience Windows likes you to change #include “SDL/SDL.h” to just #include “SDL.h” as well when I’ve compiled things on Windows in the past.
So, er… enjoy. I’ll get around to testing it on Windows and updating it accordingly if there’s errors as well…