Problem with game loop [WIN32]
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.
In games, it's better to use PeekMessage.
Your loop will look something like this
Your loop will look something like this
while(!done) { while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } direct.Draw(); }
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement