Games Programming
Played our freeware games? This programming tutorial will teach you to do all the features of
our games and more.
All examples are given in
DJGPP 2.0 and are
therefore fairly easy to convert to other C / C++ compilers.
Fast graphics are easy to do in VGA so it's the best place to start. Learn how to put the computer
into 320 X 200 resolution with 256 colours, and to display pixels.
Bitmaps are an essential structure for most games. Being able to have transparant
sections and draw a semi-offscreen image is also very useful.
For games it's no good having each keypress going into a buffer where we read it -
followed by a long pause before the key can be pressed again.
Having the PC stop and beep when you have pressed a key 15 times is no help either.
Avoid all this by replacing the keyboard interrupt handler.
If you understand basic graphics techniques you may want to move to higher resolutions.
The VESA standard provides a reliable and documented way to access higher resolutions
on virtually any modern (or even old) video card.
Creating sounds for your game will really add to the interactive feel and is well worth the effort.
Retro-Games used a simple sound blaster library for DJGPP to do this (don't reinvent the wheel).