Where do you want to go today?
  Home
  Who am I?
  Iceland
  OU tips
  Film & DVD
  Festivities
  Credits
  books
  Chili
  Chinese
  How to
  win friends

geek stuff
  spam
  PowerBook love
  Mac hacks
  Windows code
  Visual Basic
  Linux
  My Public Key
diversions...
  Kung fu
  Buffy
  Surfing...



One of the many books I got for Christmas was Jeff Prosise's classic Programming Windows with MFC 2nd Edition, and I've ploughed through it dutifully since. I've stolen this Noughts and Crosses game quite shamelessly from the book, although I've added the network features -- now you can play with anyone across your LAN. Click here to while away some hours.

Here's two little programs I wrote a while ago, guaranteed to give you endless hours of amusement. The engine comes straight from Andre LaMothe's Windows Game Programming for Dummies, which I can recommend (if you've got a little C/C++ under your belt). The biggest trouble I had in writing these was getting the pointer arithmetic to work in every screen mode. All the examples in the book are in eight bits per pixel, and so use a byte array. The author reckons you can still do this with more colours, but I just can't get it to work! (Anyone know why?) In the end I had to typedef a three byte structure for 24-bit mode. There's a way of achieving these results without utilizing a pointer to the screen memory (The Blt() function, if you're interested; I'll alter the code when I get a moment). This screen sinker/wrapper needs DirectX, and hold down the space bar to exit. Right-click and "Save Target As" here to download, or if you're a budding anorak and want to look at the source code be my guest. They're both very small downloads (couple of Kbytes), although I don't recommend you follow my erratic coding style. View at your own risk.




Just to show that I'm a paid-up member of the objectOriented->BandWagon(), here's a bat and ball game I wrote. Don't mind admitting that this took days, largely because of the OO code. Don't get me wrong, classes are great, but their benefits typically show with medium to large size programs. Still, I suppose to a certain extent it depends on what you're used to. Whilst reading Andre's book I could see plenty of functions and variables crying out for encapsulation, so I guess I should stop moaning about it and just learn to write properly. Use the arrow keys to move the bat, press space or die to quit. Again, here's the game, and here's the source.

I'd like to turn this into a Java applet, but I'll probably never get round to it.