From 350aabfa23049ad3c078303b061913ca8ff7ea64 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 5 Sep 2011 11:41:03 +0200 Subject: [PATCH] Pause the game when the window loses input focus. --- code/player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/player.cpp b/code/player.cpp index bb79300..f61ad95 100644 --- a/code/player.cpp +++ b/code/player.cpp @@ -188,7 +188,7 @@ void doPlayer() } } - if (engine.keyState[SDLK_p]) + if (engine.keyState[SDLK_p] || !(SDL_GetAppState() & SDL_APPINPUTFOCUS)) { engine.paused = true; engine.keyState[SDLK_p] = 0;