Jump to content
  • Advertisement
Sign in to follow this  
jsloan

Problem with game loop [WIN32]

This topic is 5066 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
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();

}


Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!