From 871943d6a90bdb92b3cc495d4d927199611f8c6b Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 4 Feb 2021 20:45:18 -0500 Subject: Added text boxes Text now reveals itself and scrolls! Yay! It even plays speaker beeps. TODO: the arror indicating an A press is needed. Bullets on lines that need bullets. The header that says who the speaker is, if relevant. --- src/message_system.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/message_system.h') diff --git a/src/message_system.h b/src/message_system.h index 4dd0166..153805a 100644 --- a/src/message_system.h +++ b/src/message_system.h @@ -1,10 +1,23 @@ #ifndef MESSAGE_SYSTEM_H_DE10D011 #define MESSAGE_SYSTEM_H_DE10D011 +#include +#include +#include #include "system.h" +#include "timer.h" class Game; +enum class SpeakerType { + None, + Man, + Woman, + Boy, + Girl, + Nonhuman +}; + class MessageSystem : public System { public: @@ -20,10 +33,21 @@ public: void hideCutsceneBars(); + void displayMessage(std::string_view msg, SpeakerType speaker); + + void advanceText(); + // Info double getCutsceneBarsProgress() const; + struct MessageLine { + std::string text; + int charsRevealed = 0; + }; + + const std::list& getLines() const { return linesToShow_; } + private: enum class BarsState { @@ -37,6 +61,10 @@ private: BarsState barsState_ = BarsState::Closed; double accum_ = 0.0; double length_ = 1000.0/8; + SpeakerType speaker_ = SpeakerType::None; + std::list lines_; + std::list linesToShow_; + Timer textAdvTimer_ { 10 }; }; #endif /* end of include guard: MESSAGE_SYSTEM_H_DE10D011 */ -- cgit 1.4.1