diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-12-17 19:18:23 +0000 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2017-12-17 19:18:23 +0000 |
commit | 41bebb262aa8f346ce6cdaefd854c9077ae84f97 (patch) | |
tree | 6270136442f06a406f3b101e18f12c84c63a523e /src/game/interface.cpp | |
parent | c8e7fcc5f2cac58785baf2556cffc5727a48e957 (diff) |
Implement pausing.
Diffstat (limited to 'src/game/interface.cpp')
-rw-r--r-- | src/game/interface.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/game/interface.cpp b/src/game/interface.cpp index f574732..f4403ea 100644 --- a/src/game/interface.cpp +++ b/src/game/interface.cpp @@ -3,6 +3,8 @@ namespace interface { +using namespace game; // FIXME + state_t::state_t(sf::RenderWindow *window_, game::state_t *game_) { window = window_; @@ -101,6 +103,13 @@ void state_t::tick(double dt) case sf::Event::KeyPressed: switch (event.key.code) { + case sf::Keyboard::Key::Space: + game->paused ^= 1; + if (game->paused) + print(text::get(text::PAUSED)); + else + print(text::get(text::UNPAUSED)); + break; case sf::Keyboard::Key::F1: debug_draw_cmodels ^= 1; print("debug_draw_cmodels = " + std::to_string(debug_draw_cmodels)); |