diff options
| -rw-r--r-- | engines/draci/sprite.cpp | 19 | ||||
| -rw-r--r-- | engines/draci/sprite.h | 2 | 
2 files changed, 21 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); diff --git a/engines/draci/sprite.h b/engines/draci/sprite.h index 77e45d6a7c..d2aa5ba3af 100644 --- a/engines/draci/sprite.h +++ b/engines/draci/sprite.h @@ -129,6 +129,8 @@ public:  	void setColour(byte fontColour);  	void setSpacing(uint spacing); +	uint getLength(); +  	void draw(Surface *surface, bool markDirty = true) const;  	// TODO: drawScaled just calls draw so Text can be accessed through a Drawable pointer.   | 
