INT GAME_MAIN (Void * Parms = NULL, INT NUM_PARMS = 0) {// Press ESC to exit IF (keydown (vk_escape) SendMessage (main_window_handle, wm_close, 0, 0);
MEMSET (& DDSD, 0, SIZEOF (DDSD)); DDSD.DWSIZE = SizeOf (DDSD);
// Lock the main display surface IF (failed (LPDDSPRIMARY-> Lock (Null, & DDSD, DDLOCK_SURFA PartMEMORYPTR | DDLOCK_WAIT, NULL)) Return (0);
INT LPITCH32 = (int) (DDSD.LPITCH >> 2); uint * video_buffer = (uint *) DDSD.LPSURFACE;
For (int index = 0; index <1000; index ) {// select random position and color for 640x480x32 int red = rand ()% 256; int Green = rand ()% 256; int block = rand ()% 256; INT x = rand ()% 640; int y = rand ()% 480;
UINT Pixel = ((Blue) (Green << 8) ((red) << 16) ((0) << 24)); // Writing color video_buffer [x y * lpitch32] = Pixel } // end for index
// Unlock the main display surface IF (failed (LPDDSPRIMARY-> UNLOCK (NULL))) RETURN (0);
Return (1);
} // End Game_main