This was my first attempt writing a computer game using the DirectX library. It was originally
written for DirectX 6 library, but I've made some changes that made it work with the
latest SDK. The code is based on the Windows API, without any reference to the MFC library.
The only thing you need to compile this is VC++ and DirectX SDK, which can be found at
All the processing is done when no messages are available in the application message
by calling the
UpdateFrame() function. As you see in the code, I
haven't used many classes,
and almost all the code is based on function calls. The only classes that are
Alpha: this class is used as a reference to draw characters to the screen.
This allow us to use a bitmap to draw the letters to the screen (so that the user
need to install extra fonts in the system).
Extra: Defines an "Extra" element in the screen, that can be an Ammo box,
an Bonus Box, a Weapon Advance Box or a Shield Charge.
Ovni: This class represents the UFOs that are going to be shot! Just to explain
the name of the class... Ovni means UFO in Portuguese. Since I'm a Brazilian and a Portuguese
speaker, there are some things in the code that are with my local language (don't worry,
the comments are all English :o) )
Bullet: This represents the bullets that fly around the galactic battlefield.
Each one of the classes has a 'built-in' linked list that will be used a lot in the code.
Each one of the classes have a common
Draw function the is used to draw the specific object
on the screen in its current state.
Almost everything in the code is commented, but if you have any trouble just mail me.
4 June 2002: I´ve removed a memory leak (directdraw interface was not
being released) and have improved the surface creation function
(winmain.cpp, line 3190). Now I try to create every surface on VIDEOMEMORY.
If the function returns a DDERR_OUTOFMEMORY, I try to recreate it on
SYSTEMMEMORY (winmain.cpp, line 3242).
Mauricio Ritter lives in Brazil, in the city of Porto Alegre. He is working with software development for about 8 years, and most of his work was done at a bank, within a home and office banking system.
Mauricio also holds MCSD, MCSE, MCDBA, MCAD and MCT Microsoft certifications and work as a trainer/consultant in some MS CTEC in his city.
Mauricio also works in his own programming site, aimed to Brazilian Developers: http://www.dotnetmaniacs.com.br
In his spare time he studys korean language...