Sunday, February 11, 2007

Whoohoo We Have an Executeable!

Last time I managed to get a tutorial program running that nicely integrated SDL with wxWidgets. This weekend I started on the real dummy code for Mod Wars! What I mean by "real dummy" is that I know that anything I write at this stage will get rewritten or completely trashed at some point, but I'm at a stage where I want to start structuring my projects, thinking about naming conventions and that sort of thing.

So I started off by re-writing the tutorial program as if the output was what is desired for Mod Wars. One thing I did differently this time around is change my usual naming convention. Usually all my C++ code follows the Boost naming conventions of all underscore_separated lowercase_identifiers. However, wxWidgets doesn't use that kind of naming and my code just looked odd. So instead, for any code that works directly with wxWidgets including the classes I had to derive from those in their framework, I followed their naming conventions.

Furthermore, I had already decided to split out my client code into two parts - a generic library that wasn't specific to any particular Gui, and a Gui only portion that is. The reason for this is that (gosh did I already blog about this? I feel like I'm repeating myself! anyway...) I know that I want at least two front ends for the client - the real one with my Gui library of choice which is currently wxWidgets, and a console based front-end for running unit tests and hopefully for running scrips so that I can automate execution of the client code. The second reason is that Gui libraries are a pain in the a**! I tried at least half a dozen when looking for one for Mod Wars so if I tie myself into just one, I'm sure Murphy would see to it that I change it along the way.

Back to naming conventions then... in my library code I use my internal conventions and in Gui code I'll follow the conventions of the library I am using.

Wanna see the finished product? Here's a glorious screenshot for you!


What the **** is this you are probably thinking! Many moons ago when I first decided that I wanted to write games, I started to teach myself DirectX. I had no idea where to start and I found it very difficult. I was trying to recreate a block puzzle game that I had written in MFC years earlier. The screen was supposed to be filled with little coloured blocks and instead, after days of faffing around, all I managed to produce was a solitary green block in a very odd place! So now, whenever I start writing a game that needs any kind of graphics the first thing I do is just render a green block! It also fits nicely into the "do the simplest thing that could possibly work" mantra :-)

I'll render a grid next, honest!

1 comment:

Emma Middlebrook said...

simple is good and doesn't it feel great when you actually achieve something... I bet after days of coding against colourbox, you probably felt deflated when you saw just one tiny green block, when you were actually expecting to see a screen full of lots of coloured blocks! I can just imagine your reaction :)

Keep up the good work!