RE: [GD-Windows] Suspending execution
Brought to you by:
vexxed72
|
From: Andy G. <an...@mi...> - 2002-01-07 19:33:45
|
Adding the WaitMessage like you say works great - except in network
games - but then pause is an issue anyway :-)
One other thing you may want to add is detect if you are the foreground
app and if you are not, add a Sleep(50) before the peekmessage loop - I
find this makes using debuggers or alt tabbing much much more responsive
(esp. on single processor machines).
I don't get mouse move messages all the time - maybe you have a jittery
mouse?
Andy Glaister.
-----Original Message-----
From: Brian Hook [mailto:bri...@py...]=20
Sent: Monday, January 07, 2002 11:16 AM
To: 'Gamedevlists-Windows@Lists. Sourceforge. Net'
Subject: [GD-Windows] Suspending execution
Okay, next question up. My current game is doing the traditional "run
as fast as you can" model of execution, which eats CPU like mad stupid
crazy. The traditional loop is:
while ( PeekMessage( ... ) )
{
if ( GetMessage( ... ) )=20
{=20
Translate/DispatchMessage( ... );
}
else
{
//app quit
}
}
To avoid hammering the CPU, I'm thinking of slightly changing it to:
if ( bPaused )
{
WaitMessage();
}
//do regular loop here
Are there any hidden gotchas with WaitMessage()?
One other thing I've noticed is that I'm constantly getting WM_MOUSEMOVE
messages even if the mouse isn't moving (confirmed with Spy++). I
assume this is expected behaviour?
Brian
_______________________________________________
Gamedevlists-windows mailing list
Gam...@li...
https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows
|