diff options
author | Joseph-Eugene Winzer | 2017-08-04 10:42:02 +0200 |
---|---|---|
committer | Thierry Crozat | 2018-01-23 00:29:35 +0000 |
commit | 0fdb3d8d10e0347a647cb0529c399bd74b9d8350 (patch) | |
tree | f2ce61172281b282fe48085767a76306e1b4fd2f /engines/supernova | |
parent | 160ff13934c3013479e6106cc7df0528681af2ae (diff) | |
download | scummvm-rg350-0fdb3d8d10e0347a647cb0529c399bd74b9d8350.tar.gz scummvm-rg350-0fdb3d8d10e0347a647cb0529c399bd74b9d8350.tar.bz2 scummvm-rg350-0fdb3d8d10e0347a647cb0529c399bd74b9d8350.zip |
SUPERNOVA: Extends text rendering
textWidth() and renderText() are overloaded for handling single uint16
characters (useful when rendering key strokes directly)
Diffstat (limited to 'engines/supernova')
-rw-r--r-- | engines/supernova/supernova.cpp | 15 | ||||
-rw-r--r-- | engines/supernova/supernova.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp index cde54ab193..d11f85670b 100644 --- a/engines/supernova/supernova.cpp +++ b/engines/supernova/supernova.cpp @@ -362,6 +362,11 @@ void SupernovaEngine::renderRoom(Room &room) { } } +int SupernovaEngine::textWidth(const uint16 key) { + const char text[2] = {key & 0xFF, 0}; + return textWidth(text); +} + int SupernovaEngine::textWidth(const char *text) { int charWidth = 0; while (*text != '\0') { @@ -502,10 +507,20 @@ void SupernovaEngine::renderText(const char *text, int x, int y, byte color) { _textColor = color; } +void SupernovaEngine::renderText(const uint16 character, int x, int y, byte color) { + char text[2] = {character & 0xFF, 0}; + renderText(text, x, y, color); +} + void SupernovaEngine::renderText(const char *text) { renderText(text, _textCursorX, _textCursorY, _textColor); } +void SupernovaEngine::renderText(const uint16 character) { + char text[2] = {character & 0xFF, 0}; + renderText(text, _textCursorX, _textCursorY, _textColor); +} + void SupernovaEngine::renderBox(int x, int y, int width, int height, byte color) { Graphics::Surface *screen = _system->lockScreen(); screen->fillRect(Common::Rect(x, y, x + width, y + height), color); diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h index 86d5d81b37..eef3c9d015 100644 --- a/engines/supernova/supernova.h +++ b/engines/supernova/supernova.h @@ -109,6 +109,7 @@ public: int getDOSTicks(); int textWidth(const char *text); + int textWidth(const uint16 key); void initData(); void initPalette(); void paletteFadeIn(); @@ -126,7 +127,9 @@ public: void renderMessage(const char *text, MessagePosition position = kMessageNormal); void removeMessage(); void renderText(const char *text, int x, int y, byte color); + void renderText(const uint16 character, int x, int y, byte color); void renderText(const char *text); + void renderText(const uint16 character); void renderBox(int x, int y, int width, int height, byte color); void setColor63(byte value); void command_print(); |