Quick Windows message question
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?
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement