From 2c75d95ddf849996bfc18267a9eecb4d0f4e1916 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 16 Mar 2022 15:30:37 -0400 Subject: signs can be read now! --- src/sign.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/sign.h (limited to 'src/sign.h') 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 @@ +#ifndef SIGN_H_B0491849 +#define SIGN_H_B0491849 + +#include +#include +#include +#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 lines; + std::list linesToShow; + +private: + + TTF_Font* font_; + Timer textAdvTimer_ { 15 }; +}; + +#endif /* end of include guard: SIGN_H_B0491849 */ -- cgit 1.4.1