aboutsummaryrefslogtreecommitdiff
path: root/newgui.cpp
diff options
context:
space:
mode:
authorMax Horn2002-07-15 12:59:56 +0000
committerMax Horn2002-07-15 12:59:56 +0000
commite6f6e5df8f97caf7ba2f009336efda4c760ed193 (patch)
tree9eb83388adbcda403d7263e1bad2e06aaef81be7 /newgui.cpp
parent272c391eb04b51a088e43fcbae37a84c39d8ff35 (diff)
downloadscummvm-rg350-e6f6e5df8f97caf7ba2f009336efda4c760ed193.tar.gz
scummvm-rg350-e6f6e5df8f97caf7ba2f009336efda4c760ed193.tar.bz2
scummvm-rg350-e6f6e5df8f97caf7ba2f009336efda4c760ed193.zip
allow static text/button widgets in NewGUI to be drawn centred
svn-id: r4551
Diffstat (limited to 'newgui.cpp')
-rw-r--r--newgui.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/newgui.cpp b/newgui.cpp
index e642e0ec86..0d9de41f8b 100644
--- a/newgui.cpp
+++ b/newgui.cpp
@@ -401,23 +401,25 @@ void NewGui::drawChar(const char str, int xx, int yy)
}
-void NewGui::drawString(const char *str, int x, int y, int w, byte color)
+void NewGui::drawString(const char *str, int x, int y, int w, byte color, bool center)
{
- StringTab *st = &_s->string[5];
- st->charset = 1;
- st->center = false;
- st->color = color;
- st->xpos = x;
- st->ypos = y;
- st->right = x + w;
-
if (_s->_gameId) { /* If a game is active.. */
+ StringTab *st = &_s->string[5];
+ st->charset = 1;
+ st->center = center;
+ st->color = color;
+ st->xpos = center ? x+w/2 : x;
+ st->ypos = y;
+ st->right = x + w;
+
_s->_messagePtr = (byte *)str;
_s->drawString(5);
} else {
+ // FIXME - support center, use nicer custom font. Ultimately, we might
+ // want to *always* draw our messages this way.
uint len = strlen(str);
for (uint letter = 0; letter < len; letter++)
- drawChar(str[letter], st->xpos + (letter * 8), st->ypos);
+ drawChar(str[letter], x + (letter * 8), y);
}
}