diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2021-03-13 07:45:55 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2021-03-13 15:34:50 -0500 |
commit | 764efea5a38b970fa57d8c0197673276023b58aa (patch) | |
tree | 25aebaa5e62147aaabdfcec6c44d36164d9e6fd7 /src/menu_system.cpp | |
parent | 142e00794097dfb78c4b758a2d39d26fae070092 (diff) | |
download | tanetane-764efea5a38b970fa57d8c0197673276023b58aa.tar.gz tanetane-764efea5a38b970fa57d8c0197673276023b58aa.tar.bz2 tanetane-764efea5a38b970fa57d8c0197673276023b58aa.zip |
Added pause menu opening and closing animation
#7
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 | } | ||