diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-16 15:30:37 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-16 15:30:37 -0400 |
commit | 2c75d95ddf849996bfc18267a9eecb4d0f4e1916 (patch) | |
tree | 285315deeaf4b5153b5f92f0c8a23af557626204 /src/sign.h | |
parent | 8713d03831226dcd559c6a1e2b1c7b0d7c660bac (diff) | |
download | ether-2c75d95ddf849996bfc18267a9eecb4d0f4e1916.tar.gz ether-2c75d95ddf849996bfc18267a9eecb4d0f4e1916.tar.bz2 ether-2c75d95ddf849996bfc18267a9eecb4d0f4e1916.zip |
signs can be read now!
Diffstat (limited to 'src/sign.h')
-rw-r--r-- | src/sign.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/sign.h b/src/sign.h new file mode 100644 index 0000000..c90a8fd --- /dev/null +++ b/src/sign.h | |||
@@ -0,0 +1,45 @@ | |||
1 | #ifndef SIGN_H_B0491849 | ||
2 | #define SIGN_H_B0491849 | ||
3 | |||
4 | #include <string> | ||
5 | #include <list> | ||
6 | #include <SDL_ttf.h> | ||
7 | #include "interpolation.h" | ||
8 | #include "timer.h" | ||
9 | |||
10 | class Game; | ||
11 | |||
12 | enum class SignInstructionState { | ||
13 | Hidden, | ||
14 | FadingIn, | ||
15 | Visible, | ||
16 | FadingOut | ||
17 | }; | ||
18 | |||
19 | struct SignLine { | ||
20 | std::string text; | ||
21 | bool pause = false; | ||
22 | int charsRevealed = 0; | ||
23 | }; | ||
24 | |||
25 | class Sign { | ||
26 | public: | ||
27 | |||
28 | explicit Sign(TTF_Font* font) : font_(font) {} | ||
29 | |||
30 | void displayMessage(std::string text); | ||
31 | |||
32 | void update(size_t dt, Game& game); | ||
33 | |||
34 | SignInstructionState signDisplayState = SignInstructionState::Hidden; | ||
35 | Interpolation signDisplayFade; | ||
36 | std::list<SignLine> lines; | ||
37 | std::list<SignLine> linesToShow; | ||
38 | |||
39 | private: | ||
40 | |||
41 | TTF_Font* font_; | ||
42 | Timer textAdvTimer_ { 15 }; | ||
43 | }; | ||
44 | |||
45 | #endif /* end of include guard: SIGN_H_B0491849 */ | ||