mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-21 18:10:26 +01:00
Pause the game when the window is minimized
This commit is contained in:
parent
4c0b882e85
commit
65ff2cad03
|
@ -85,6 +85,11 @@ BOOL PeekMessage(MSG *msg, void *hwnd, UINT wMsgFilterMin,
|
|||
msg->message = WM_PAINT;
|
||||
return TRUE;
|
||||
}
|
||||
if (sdlevent.window.event == SDL_WINDOWEVENT_MINIMIZED)
|
||||
{
|
||||
msg->wParam = sdlevent.window.event;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
// These all map to WM_* things without any drama.
|
||||
|
|
|
@ -1028,7 +1028,21 @@ int SubMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
|
|||
}
|
||||
}
|
||||
#else
|
||||
STUBBED("SDL2 can handle these events");
|
||||
if( msg.message==SDL_WINDOWEVENT)
|
||||
{
|
||||
switch( msg.wParam) {
|
||||
case SDL_WINDOWEVENT_MINIMIZED:
|
||||
if( _bWindowChanging) break;
|
||||
_bWindowChanging = TRUE;
|
||||
_bReconsiderInput = TRUE;
|
||||
// if allowed, not already paused and only in single player game mode
|
||||
if( sam_bPauseOnMinimize && !_pNetwork->IsPaused() && _gmRunningGameMode==GM_SINGLE_PLAYER) {
|
||||
// pause game
|
||||
_pNetwork->TogglePause();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// toggle full-screen on alt-enter
|
||||
|
|
Loading…
Reference in New Issue
Block a user