aboutsummaryrefslogtreecommitdiff
path: root/gui/newgui.cpp
diff options
context:
space:
mode:
authorMax Horn2002-09-26 11:44:02 +0000
committerMax Horn2002-09-26 11:44:02 +0000
commit58e5e0069f82c9319fd9c6f6987f98886c3b9f67 (patch)
tree06b5cecf9be064323abd796ceac093b5b996a7aa /gui/newgui.cpp
parent522ee88b62206fabb18ce5e4f9221da89b766663 (diff)
downloadscummvm-rg350-58e5e0069f82c9319fd9c6f6987f98886c3b9f67.tar.gz
scummvm-rg350-58e5e0069f82c9319fd9c6f6987f98886c3b9f67.tar.bz2
scummvm-rg350-58e5e0069f82c9319fd9c6f6987f98886c3b9f67.zip
added simple message dialog
svn-id: r5020
Diffstat (limited to 'gui/newgui.cpp')
-rw-r--r--gui/newgui.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 7adfa1aaea..dbdf9d170d 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -401,11 +401,12 @@ void NewGui::drawChar(const char chr, int xx, int yy, int16 color)
}
}
-int NewGui::getStringWidth(const char *str)
+int NewGui::getStringWidth(const String &str)
{
int space = 0;
- while (*str)
- space += getCharWidth(*str++);
+
+ for (int i = 0; i < str.size(); ++i)
+ space += getCharWidth(str[i]);
return space;
}
@@ -414,17 +415,17 @@ int NewGui::getCharWidth(char c)
return guifont[c+6];
}
-void NewGui::drawString(const char *str, int x, int y, int w, int16 color, int align)
+void NewGui::drawString(const String &str, int x, int y, int w, int16 color, int align)
{
int width = getStringWidth(str);
if (align == kTextAlignCenter)
x = x + (w - width - 1)/2;
else if (align == kTextAlignRight)
x = x + w - width;
- while (*str) {
- drawChar(*str, x, y, color);
- x += getCharWidth(*str);
- str++;
+
+ for (int i = 0; i < str.size(); ++i) {
+ drawChar(str[i], x, y, color);
+ x += getCharWidth(str[i]);
}
}