Menu
Forums
Login | Register

Home > Forums > Win32 > More CPU-friendly message loop Page :  1 
More CPU-friendly message loop
Hi, I've read that a message loop for a game should use a 'real-time' message loop such as:

while(TRUE)
{
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

if(msg.message == WM_QUIT)
break;
}

However when I implemented it into my programs I find that it hogs up a lot of the CPU Usage and causes excessive system lag. So, I was wondering what would be a proper method to prevent or fix this problem while still having a real-time message loop. Any help is appreciated.

Home > Forums > Win32 > More CPU-friendly message loop Page :  1 

You need to be logged in to reply to this topic.


All Rights Reserved, © Zeus Communications, Multimedia & Development 2004-2005

Read the Disclaimer

Links