aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/sprite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/draci/sprite.cpp')
-rw-r--r--engines/draci/sprite.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp
index 31a55bfddb..ecbfaf2767 100644
--- a/engines/draci/sprite.cpp
+++ b/engines/draci/sprite.cpp
@@ -307,6 +307,13 @@ Text::Text(const Common::String &str, Font *font, byte fontColour,
_delay = 0;
_text = str;
+
+ _length = 0;
+ for (uint i = 0; i < _text.size(); ++i) {
+ if (_text[i] != '|') {
+ ++_length;
+ }
+ }
_spacing = spacing;
_colour = fontColour;
@@ -321,10 +328,18 @@ Text::Text(const Common::String &str, Font *font, byte fontColour,
}
void Text::setText(const Common::String &str) {
+
_width = _font->getStringWidth(str, _spacing);
_height = _font->getStringHeight(str);
_text = str;
+
+ _length = 0;
+ for (uint i = 0; i < _text.size(); ++i) {
+ if (_text[i] != '|') {
+ ++_length;
+ }
+ }
}
void Text::setColour(byte fontColour) {
@@ -335,6 +350,10 @@ void Text::setSpacing(uint spacing) {
_spacing = spacing;
}
+uint Text::getLength() {
+ return _length;
+}
+
void Text::draw(Surface *surface, bool markDirty) const {
_font->setColour(_colour);