Tuesday, December 29, 2009

2D Engine/Game

This is sort of the highlight of my sad sad day, so I had to post this. I've been working on a 2D game, but at the same time, abstracting as much of the API specific code I could. For simplicity, I started out with SDL. Now I have OpenGL working, minus alpha blending. The best part is that the rendering engine can be switched by changing only one line of code(a few letters at that). I'm still fairly new to OpenGL, but I'm already glad I went that route, as the drawing is MUCH faster than SDL. 300FPS faster in the comparison above. Note that the tilesheet is being drawn 1 32x32 tile at a time.

Wednesday, December 23, 2009

C++ Code snippets

I said earlier that I would post some C++, so here we go.

Feel free to use my code in any way you see fit. I'd be curious to know if my code gets put to use, so leave a comment on here or something.

The following code is designed to run in a Win32 environment.

DataLogger.h / DataLogger.cpp - http://pastebin.com/f3a5eae52
Log to file - singleton class interface, various modes/levels of logging.

GameTimer.h / GameTimer.cpp - http://pastebin.com/fd99d76d
Timer - class interface

FontPrint.h / FontPrint.cpp - http://pastebin.com/f562ab8
On-screen debug output - drawing implemented using abstract drawing interface. Here's the 2-bit 8x8 font I use - http://farm3.static.flickr.com/2583/4209666632_c5da74397b_o.gif

And that's all I've got for now, the rest is still pretty well in active development.

Monday, December 14, 2009

Project list update

Been working on a lot of random stuff the past few weeks but had not posted anything to my blog, so here we go.

Still haven't worked out the kinks on my RGB Lighting project. I'm really not getting the results I want with Software based PWM, at this point, I'm getting ready to ditch the integrated IR receiver I had originally planned, in favor of actually finishing the project. I might be able to use some code posted on Lucas Eckels Blog, called IRMon. Check out his original post here. I haven't had a chance to test it yet, and some calls to delay will need to be changed to non-blocking routines, but there is a slim chance it will work for my purposes.

I've also started working on my 2D side-scroller once more. I'm working on making a Mario clone for right now, but the real purpose of this project is to develop some modular 2D framework. Nothing worth putting in pictures yet, but I will be posting bits of code later which I'm hoping others can make use of.