while(TRUE)
{
if (PeekMessage( &lpMsg, NULL, 0, 0, PM_REMOVE ) ) // begin the message loop
{
if (lpMsg.message == WM_QUIT)
break;
TranslateMessage( &lpMsg );
DispatchMessage( &lpMsg );
Game_Main(NULL, 0);
}
}
This is being run on Win2K. Any suggestions?
Thanks,
Aaron
Lag when calling main game function from event loop.
When I call my Game_Main function from the event loop the program runs very unevenly. There are long pauses then the program catches up. Game_Main isn''t doing much other than updating the locations of a couple of objects, and blting them to a back buffer then flipping the primary and secondary surfaces. The jerkiness is alleviated and everything appears to run smoothly if I start a timer, even though I don''t do anything with the timer messages. The event loop is:
It's because you're only calling the game function if you have received a windows message. You should take the Game_Main call out of that if statement (but keep it in the infinite loop).
When you set a timer, windows will keep sending you messages, which was why it worked when you tried that.
John B
Edited by - JohnBSmall on March 2, 2002 3:37:08 PM
When you set a timer, windows will keep sending you messages, which was why it worked when you tried that.
John B
Edited by - JohnBSmall on March 2, 2002 3:37:08 PM
The best thing about the internet is the way people with no experience or qualifications can pretend to be completely superior to other people who have no experience or qualifications.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement