Problem with game loop [WIN32]

Started by
1 comment, last by jsloan 19 years, 7 months ago
Hi all, I am having a problem with my DirectDraw game. It seems that i absolutly HAVE to put the rendering code under the WM_PAINT message handler. If i try putting it the idle state of my GetMessage loop i get nothing just a blank black window. heres what i have as my Message loop while (!done) { if (GetMessage (&msg, NULL, 0, 0) > 0) { TranslateMessage (&msg); DispatchMessage (&msg); } else { // Update scene direct.Draw(); } } What am i doing wrong? Thank you.
Advertisement
In games, it's better to use PeekMessage.

Your loop will look something like this

while(!done)	{		while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))		{			TranslateMessage(&msg);			DispatchMessage(&msg);		}		direct.Draw();	}
Thank you, i really appreciate your solution !

This topic is closed to new replies.

Advertisement