Original Post
i am using the WGPFD book. i noe the code provided for its double buffer is in 8bit mode. so i tried to modify it to become
a 16bit one.
i tried 1) changing all the UCHAR to USHORT
2) adding #define _RGB16BIT(r,g,b) ((b%32)+((g%32)<<5)+((r%32)<<10))
3) changing SCREEN_BPP to 16
4) modifying the game logic to this>
// draw the next frame into the double buffer
// plot 5000 random pixels
for (int index=0; index<5000; index++)
{
int x = rand()%SCREEN_WIDTH;
int y = rand()%SCREEN_HEIGHT;
USHORT r = rand()%256;
USHORT g = rand()%256;
USHORT b = rand()%256;
double_buffer[x+(y*ddsd.lPitch >> 1)] = _RGB16BIT(r,g,b);
} // end for index
But i jus couldnt get the thing work