summary refs log tree commit diff stats
path: root/src/message_system.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-05 17:38:30 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-05 17:38:30 -0500
commitea78916cc43fe67690f2f92d88ac4a8b0e9857d8 (patch)
tree25054fa080f8a7d452b588d8031b254ee6ce998c /src/message_system.cpp
parentf7875a6d2f129af47a203a5a31c2785b6e2fcf58 (diff)
downloadtanetane-ea78916cc43fe67690f2f92d88ac4a8b0e9857d8.tar.gz
tanetane-ea78916cc43fe67690f2f92d88ac4a8b0e9857d8.tar.bz2
tanetane-ea78916cc43fe67690f2f92d88ac4a8b0e9857d8.zip
Added little bobbing "next message" arrow
Diffstat (limited to 'src/message_system.cpp')
-rw-r--r--src/message_system.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/message_system.cpp b/src/message_system.cpp index 08ef799..0b0d53e 100644 --- a/src/message_system.cpp +++ b/src/message_system.cpp
@@ -3,7 +3,7 @@
3#include "util.h" 3#include "util.h"
4 4
5const int CHARS_TO_REVEAL = 1; 5const int CHARS_TO_REVEAL = 1;
6const int CHARS_PER_BEEP = 10; 6const int CHARS_PER_BEEP = 8;
7 7
8void MessageSystem::tick(double dt) { 8void MessageSystem::tick(double dt) {
9 if (barsState_ == BarsState::Opening || barsState_ == BarsState::Closing) { 9 if (barsState_ == BarsState::Opening || barsState_ == BarsState::Closing) {
@@ -59,6 +59,27 @@ void MessageSystem::tick(double dt) {
59 59
60 linesToShow_.push_back(MessageLine { .text = lines_.front() }); 60 linesToShow_.push_back(MessageLine { .text = lines_.front() });
61 lines_.pop_front(); 61 lines_.pop_front();
62 } else {
63 showNextArrow_ = true;
64 }
65 }
66 }
67
68 if (showNextArrow_) {
69 nextArrowBobTimer_.accumulate(dt);
70 while (nextArrowBobTimer_.step()) {
71 if (nextArrowBobDown_) {
72 nextArrowBobPos_++;
73
74 if (nextArrowBobPos_ >= 4) {
75 nextArrowBobDown_ = false;
76 }
77 } else {
78 nextArrowBobPos_--;
79
80 if (nextArrowBobPos_ <= 0) {
81 nextArrowBobDown_ = true;
82 }
62 } 83 }
63 } 84 }
64 } 85 }
@@ -172,6 +193,7 @@ void MessageSystem::advanceText() {
172 } 193 }
173 194
174 lines_.pop_front(); 195 lines_.pop_front();
196 showNextArrow_ = false;
175 197
176 if (lines_.empty()) { 198 if (lines_.empty()) {
177 linesToShow_.clear(); 199 linesToShow_.clear();