diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-04 20:45:18 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-02-04 20:45:18 -0500 |
commit | 871943d6a90bdb92b3cc495d4d927199611f8c6b (patch) | |
tree | 9be125438747f7370cfa56e3f3e42f8c68982852 /src/message_system.h | |
parent | 138e0a8f83e82c6109bfc387ac7417d4f41711b4 (diff) | |
download | tanetane-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.h | 28 |
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 | ||
6 | class Game; | 10 | class Game; |
7 | 11 | ||
12 | enum class SpeakerType { | ||
13 | None, | ||
14 | Man, | ||
15 | Woman, | ||
16 | Boy, | ||
17 | Girl, | ||
18 | Nonhuman | ||
19 | }; | ||
20 | |||
8 | class MessageSystem : public System { | 21 | class MessageSystem : public System { |
9 | public: | 22 | public: |
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 | |||
27 | private: | 51 | private: |
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 */ |