mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-11-22 02:20:25 +01:00
Merge pull request #65 from twolife/pause
Pause the game when the window is minimized
This commit is contained in:
commit
3e36706d26
|
@ -85,6 +85,11 @@ BOOL PeekMessage(MSG *msg, void *hwnd, UINT wMsgFilterMin,
|
||||||
msg->message = WM_PAINT;
|
msg->message = WM_PAINT;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
if (sdlevent.window.event == SDL_WINDOWEVENT_MINIMIZED)
|
||||||
|
{
|
||||||
|
msg->wParam = sdlevent.window.event;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// These all map to WM_* things without any drama.
|
// These all map to WM_* things without any drama.
|
||||||
|
|
|
@ -1028,7 +1028,21 @@ int SubMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
||||||
// toggle full-screen on alt-enter
|
// toggle full-screen on alt-enter
|
||||||
|
|
Loading…
Reference in New Issue
Block a user