Freeze game when app loses focus
BlitzMax Forums/MaxGUI Module/Freeze game when app loses focus
| ||
**EDIT** Whoops, I meant to put this in the programming section. I'll repost in a few days in the right section if I don't get an answer. I would like my game to freeze when it loses focus and resume when it gains focus. Could someone please push me in the right direction? I figure it would have to be through a windows dll of some sort - which I'm clueless on the whole OS side of things anyway. Thanks! |
| ||
You might try searching, because I would have sworn a few months ago, GfK posted some code for exactly that. |
| ||
Hiya I'm not sure how Gfk did it, but you can use PollEvent to return EVENT_APPRESUME and EVENT_APPSUSPEND appropriately. Strict Graphics 800,600 While Not KeyDown(KEY_ESCAPE) Cls Local id = PollEvent() If id = EVENT_APPSUSPEND Print "App suspended" If id = EVENT_APPRESUME Print "App resumed" Flip Wend |
| ||
You could also try something like...If AppSuspended() pauseGame = True else pauseGame = false endif...Which amounts to the same thing. |