diff options
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 */ | ||