The game engine has been coming along quite well recently. I’ve been doing a lot of work on it, as it’s school holidays.
I moved all the image code over to OpenGL, which was surprisingly easy. All I had to do was change a bit of initialisation code, and then rewrite the code that draws bitmaps. Instead of blitting them onto the screen, now images are rendered as textures. This gives me some very big advantages. Firstly, I have to call one command to rotate an image – something I was having a lot of trouble doing before. Also, I should be able to make it more resolution independent, and allow the user to play the game fullscreen.
I was having some trouble initially with OpenGL – I was just getting a black screen. Eventually I found that I was clearing the screen after drawing everything… At least then I could get white (or coloured) rectangles to render, but I was still having problems mapping the texture to them. After a long, frustrating debug session, I found that I had just accidentally put two arguments around the wrong way on a function call… Suddenly everything worked perfectly!
Now the engine is running just as well as before, I have added some button and menu support, as seen in the images posted. The buttons have mouse-over colours, and you can define sounds that play on mouseover and click. You can also define either a function to execute after the button is pressed or give it the name of a menu to switch to. The system works very well, and I am quite happy with it.
Here are some more pictures of it in action; I would like to post a Windows binary, but Visual Studio won’t install properly. So for now, if you want to try it out, you can grab this Linux binary. It was compiled on Ubuntu 7.10, and requires OpenGL, LibSDL 1.2, LibSDL-ttf, LibSDL-mixer, and LibSDL-image.
Looks good!