Quick Windows message question

Started by
1 comment, last by Agony 19 years, 7 months ago
Hey, I am writing a game and i want it to pause every time my mouse leaves the window and everytime i have another window on top of it, how do i do this?
Advertisement
Have a global flag for "gamePaused", run your game loop whenever the flag isn't set. To set/unset the flag, hook the WM_ACTIVATE message in your Windows loop, setting your paused flag if the WPARAM is set to WA_INACTIVE and unsetting it if WPARAM is WA_CLICKACTIVE || WA_ACTIVE

This will pause your game whenever the game window isn't active and restart it when it is.
Here are three suggestions I found by using [google]. I've used the second one before, and the first one sounds promising too. The third sounds a bit overly complex, but maybe I'm wrong.
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke

This topic is closed to new replies.

Advertisement