[GD-Windows] message pump problem
Brought to you by:
vexxed72
From: Marin K. <m.k...@in...> - 2003-11-24 09:18:34
|
[sorry, this may be posted twice, I posted it from the wrong account and it got stuck for moderator approval] Hi, I was wondering exactly what code you guys use for your message pumps? The thing is that after recent bug hunting I changed the pump to something like while(1) { if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { GetMessage(&msg, NULL, 0, 0); TranslateMessage(&msg); DispatchMessage(&msg); } else { //do game frame here } } , and I've had a support mail from a guy to whom the game stops at the loading screen. After inspecting his logs, it turns out that he's getting an endless stream of WM_PAINT messages, and the game loop stuff never gets executed. I've reread the GetMessage/PeekMessage stuff in MSDN and there's some mumbo-jumbo about WM_PAINT messages not being removed from the queue by GetMessage(), and system issueing WM_PAINT messages when the queue is empty but, frankly, I didn't manage to understand any of it. So, what exactly if the correct way to handle this? I've created a workaround and while it works, it's ugly as hell and I'd rather it's not there at all. Thanks, Marin Kovacic Lemonade Productions http://www.lemonade-p.com |