summary refs log tree commit diff stats
path: root/src/message_system.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-04 20:45:18 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-04 20:45:18 -0500
commit871943d6a90bdb92b3cc495d4d927199611f8c6b (patch)
tree9be125438747f7370cfa56e3f3e42f8c68982852 /src/message_system.h
parent138e0a8f83e82c6109bfc387ac7417d4f41711b4 (diff)
downloadtanetane-871943d6a90bdb92b3cc495d4d927199611f8c6b.tar.gz
tanetane-871943d6a90bdb92b3cc495d4d927199611f8c6b.tar.bz2
tanetane-871943d6a90bdb92b3cc495d4d927199611f8c6b.zip
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.
Diffstat (limited to 'src/message_system.h')
-rw-r--r--src/message_system.h28
1 files changed, 28 insertions, 0 deletions
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 @@
1#ifndef MESSAGE_SYSTEM_H_DE10D011 1#ifndef MESSAGE_SYSTEM_H_DE10D011
2#define MESSAGE_SYSTEM_H_DE10D011 2#define MESSAGE_SYSTEM_H_DE10D011
3 3
4#include <list>
5#include <string_view>
6#include <string>
4#include "system.h" 7#include "system.h"
8#include "timer.h"
5 9
6class Game; 10class Game;
7 11
12enum class SpeakerType {
13 None,
14 Man,
15 Woman,
16 Boy,
17 Girl,
18 Nonhuman
19};
20
8class MessageSystem : public System { 21class MessageSystem : public System {
9public: 22public:
10 23
@@ -20,10 +33,21 @@ public:
20 33
21 void hideCutsceneBars(); 34 void hideCutsceneBars();
22 35
36 void displayMessage(std::string_view msg, SpeakerType speaker);
37
38 void advanceText();
39
23 // Info 40 // Info
24 41
25 double getCutsceneBarsProgress() const; 42 double getCutsceneBarsProgress() const;
26 43
44 struct MessageLine {
45 std::string text;
46 int charsRevealed = 0;
47 };
48
49 const std::list<MessageLine>& getLines() const { return linesToShow_; }
50
27private: 51private:
28 52
29 enum class BarsState { 53 enum class BarsState {
@@ -37,6 +61,10 @@ private:
37 BarsState barsState_ = BarsState::Closed; 61 BarsState barsState_ = BarsState::Closed;
38 double accum_ = 0.0; 62 double accum_ = 0.0;
39 double length_ = 1000.0/8; 63 double length_ = 1000.0/8;
64 SpeakerType speaker_ = SpeakerType::None;
65 std::list<std::string> lines_;
66 std::list<MessageLine> linesToShow_;
67 Timer textAdvTimer_ { 10 };
40}; 68};
41 69
42#endif /* end of include guard: MESSAGE_SYSTEM_H_DE10D011 */ 70#endif /* end of include guard: MESSAGE_SYSTEM_H_DE10D011 */