diff options
Diffstat (limited to 'engines/cine/gfx.cpp')
-rw-r--r-- | engines/cine/gfx.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index b266b84647..a4220e6e35 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -259,6 +259,17 @@ void FWRenderer::drawCommand() { } } +void FWRenderer::drawString(const char *string, byte param) { + int width; + + width = getStringWidth(string) + 10; + width = width > 300 ? 300 : width; + + drawMessage(string, (320 - width) / 2, 80, width, 4); + + blit(); +} + /** * Draw message in a box * @param str Message to draw @@ -456,6 +467,21 @@ int FWRenderer::drawChar(char character, int x, int y) { return x; } +int FWRenderer::getStringWidth(const char *str) { + const char *p = str; + int width = 0; + + while (*p) { + if (*p == ' ') + width += 5; + else + width += g_cine->_textHandler.fontParamTable[(unsigned char)*p].characterWidth; + p++; + } + + return width; +} + /** * Draw Line * @param x Line end coordinate |