|main page | gallery | rationale | contact|
a particle simulation using DirectDraw and DirectInput
I wrote this particle simulation as a technology demonstration for part of a larger game that never was finished, or even coordinated enough to really get started. Cleaning up some of my old DirectDraw and DirectInput code, I hacked together this neat demo in a couple hours. Five minutes of entertainment, guaranteed.
What Was Difficult?
Not much. Refactoring code was fairly fun, but I may have got a bit carried away as I tried to combine the best aspects of two of my old graphics libraries. At this point, I didn't have enough of an idea about object oriented design to come up with a cohesive DirectDraw/DirectInput wrapper, so there are plenty of naked COM calls in the code.
How nasty is COM to work with? Here's a code snippet to set the video mode.
Lots of bitwise flags, lots of headache-inducing preprocessor macros that declare namespaces, lots of merely adequate online documentation.
Thankfully, I didn't have to figure out a lot of this on my own; I had both an article from Dr. Dobb's (fine) Programming Journal detailing DirectDraw work as well as a hefty tome of wisdom by famed game programmer Andre LaMothe. Even with these two references, it was still a bit of hit-and-miss with DirectDraw. After several unresponsive blank screens, I memorized the keystrokes to switch to Visual Studio, open the Debug menu and stop the program, saving me a reboot and sometimes letting me track down the exception that I had been unable to see in full-screen mode.
What you need to compile & run this
For Windows, I'd recommend Microsoft Visual C++ 6.0 or greater, since that's exactly the tool I used to develop this project. You'll also need the DirectX 7.0a or newer SDK -- thanks to COM, they're backwards compatible. This is currently available from:
For Linux, you're out of luck. Unless you feel like messing with WINE, but neither I or the WINE programmers will guarantee you any degree of success. But hey -- it never hurts to try. Let me know if you manage to get it working, and I'll give you something cool for your efforts.
Controls (also listed during simulation)
Last updated: 2003.03.03 by firstname.lastname@example.org