Skip to content

Commit

Permalink
Pause the game when window loses focus, fixes #513
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Mar 16, 2015
1 parent 8e52a5b commit 4344af0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/supertux/screen_manager.cpp
Expand Up @@ -27,6 +27,7 @@
#include "supertux/console.hpp"
#include "supertux/constants.hpp"
#include "supertux/gameconfig.hpp"
#include "supertux/game_session.hpp"
#include "supertux/globals.hpp"
#include "supertux/main.hpp"
#include "supertux/menu/menu_storage.hpp"
Expand Down Expand Up @@ -213,6 +214,12 @@ ScreenManager::process_events()
event.window.data2);
m_menu_manager->on_window_resize();
break;

case SDL_WINDOWEVENT_FOCUS_LOST:
if(GameSession::current() != NULL) {
GameSession::current()->toggle_pause();
}
break;
}
break;

Expand Down

0 comments on commit 4344af0

Please sign in to comment.