aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Kasak2009-07-01 16:14:04 +0000
committerDenis Kasak2009-07-01 16:14:04 +0000
commit1373eeea126ea576d1b99d6df27238bb8d6c6b90 (patch)
treebff7836afa7092c824df5affa082471d26f21ae7
parent1402a3f5fed4b3b97050924ad56bd4bfaf602a42 (diff)
downloadscummvm-rg350-1373eeea126ea576d1b99d6df27238bb8d6c6b90.tar.gz
scummvm-rg350-1373eeea126ea576d1b99d6df27238bb8d6c6b90.tar.bz2
scummvm-rg350-1373eeea126ea576d1b99d6df27238bb8d6c6b90.zip
Made Text objects calculate their widths and heights properly.
svn-id: r41998
-rw-r--r--engines/draci/draci.cpp2
-rw-r--r--engines/draci/sprite.cpp6
2 files changed, 7 insertions, 1 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index 6558e777cf..4c4ed39ee3 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -129,7 +129,7 @@ int DraciEngine::go() {
Common::String testString = "Testing, testing, read all about it!";
xpos = (kScreenWidth - _font->getStringWidth(testString, 1)) / 2;
ypos = 130;
- Text txt(testString, _font, kFontColour1, xpos, ypos, 1);
+ Text txt(testString, _font, kFontColour1, xpos, ypos, 0, 1);
txt.draw(surf);
diff --git a/engines/draci/sprite.cpp b/engines/draci/sprite.cpp
index 43cab8838b..afabdf96ce 100644
--- a/engines/draci/sprite.cpp
+++ b/engines/draci/sprite.cpp
@@ -145,6 +145,9 @@ Text::Text(const Common::String &str, Font *font, byte fontColour,
_colour = fontColour;
_font = font;
+
+ _width = _font->getStringWidth(str, _spacing);
+ _height = _font->getFontHeight();
}
Text::~Text() {
@@ -157,6 +160,9 @@ void Text::setText(const Common::String &str) {
uint len = str.size();
_length = len;
+ _width = _font->getStringWidth(str, _spacing);
+ _height = _font->getFontHeight();
+
_text = new byte[len];
memcpy(_text, str.c_str(), len);
}