If you are trying to get started in Win95/98 or DirectX programming then you can download the following code which shows the basics of Windows/DirectX and 2D graphics programing. It also uses 16bit color (which is standard for new games these days) & loads & plays a WAV sound file.
Download example code ZIP (41k)
Graphics programming in 16bit color is a bit more complex than
in 256 (8bit) colors.
First of all there are multiple formats for RGB/16bit color
DirectDraw surfaces & you need to support all the possibilities.
For code to do this, have a look at the
Angelic-Coders site,
which also has other info on DirectX programming.
MEMCPY - The memcpy() function (at least in Watcom), only runs
at full speed when copying DWORD aligned memory. In practice what
this means is that it works fine for copying lines of 16bit graphics
to the screen when the target position starts on an even X coordinate
(on-screen), but you need an alternate function for dealing with
copying to the screen where the target start point (X coordinate) is
an odd pixel.
So when copying memory that is not DWORD-aligned, but rather 2
bytes (16bits/1 short) offset from the next DWORD, use an alternate
function in order to avoid major slowdown.
Before copying a line of memory, check to see if the target X coordinate
is odd or even. If it is even, use the normal memcpy() function,
otherwise use an alternative that will do DWORD aligned copies.
All these topics are shown in code form in the example program at the top of the page.