diff options
Diffstat (limited to 'src/menu_system.cpp')
-rw-r--r-- | src/menu_system.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/menu_system.cpp b/src/menu_system.cpp index a5f3539..7c7d162 100644 --- a/src/menu_system.cpp +++ b/src/menu_system.cpp | |||
@@ -1,2 +1,28 @@ | |||
1 | #include "menu_system.h" | 1 | #include "menu_system.h" |
2 | #include "game.h" | 2 | #include "game.h" |
3 | |||
4 | void MenuSystem::tick(double dt) { | ||
5 | pauseAnimation_.tick(dt); | ||
6 | |||
7 | if (openState_ == OpenState::Animating && pauseAnimation_.isComplete()) { | ||
8 | if (pauseAnimation_.getProgress() == 0.0) { | ||
9 | openState_ = OpenState::Closed; | ||
10 | |||
11 | game_.unpauseGameplay(); | ||
12 | } else if (pauseAnimation_.getProgress() == 1.0) { | ||
13 | openState_ = OpenState::Open; | ||
14 | } | ||
15 | } | ||
16 | } | ||
17 | |||
18 | void MenuSystem::openPauseMenu() { | ||
19 | pauseAnimation_.start(125, 1.0); | ||
20 | openState_ = OpenState::Animating; | ||
21 | |||
22 | game_.pauseGameplay(); | ||
23 | } | ||
24 | |||
25 | void MenuSystem::closePauseMenu() { | ||
26 | pauseAnimation_.start(125, 0.0); | ||
27 | openState_ = OpenState::Animating; | ||
28 | } | ||