Sign in to follow this  

Problem with game loop [WIN32]

This topic is 4886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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();

}


Share this post


Link to post
Share on other sites
Sign in to follow this