Sign in to follow this  
jsloan

Problem with game loop [WIN32]

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this