summary refs log tree commit diff stats
path: root/src/sign.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sign.h')
-rw-r--r--src/sign.h45
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
10class Game;
11
12enum class SignInstructionState {
13 Hidden,
14 FadingIn,
15 Visible,
16 FadingOut
17};
18
19struct SignLine {
20 std::string text;
21 bool pause = false;
22 int charsRevealed = 0;
23};
24
25class Sign {
26public:
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
39private:
40
41 TTF_Font* font_;
42 Timer textAdvTimer_ { 15 };
43};
44
45#endif /* end of include guard: SIGN_H_B0491849 */