summary refs log tree commit diff stats
path: root/src/sign.h
blob: c90a8fd26d70ca009af7ab2c4c454956a5d142a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef SIGN_H_B0491849
#define SIGN_H_B0491849

#include <string>
#include <list>
#include <SDL_ttf.h>
#include "interpolation.h"
#include "timer.h"

class Game;

enum class SignInstructionState {
  Hidden,
  FadingIn,
  Visible,
  FadingOut
};

struct SignLine {
  std::string text;
  bool pause = false;
  int charsRevealed = 0;
};

class Sign {
public:

  explicit Sign(TTF_Font* font) : font_(font) {}

  void displayMessage(std::string text);

  void update(size_t dt, Game& game);

  SignInstructionState signDisplayState = SignInstructionState::Hidden;
  Interpolation signDisplayFade;
  std::list<SignLine> lines;
  std::list<SignLine> linesToShow;

private:

  TTF_Font* font_;
  Timer textAdvTimer_ { 15 };
};

#endif /* end of include guard: SIGN_H_B0491849 */