From 6b5eab62f6146beda92b686f10797b8e28a2ffe3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 24 Dec 2017 09:44:15 -0500 Subject: XEEN: Fix animated text cursor partialy overlapping prior char --- engines/xeen/dialogs_input.cpp | 7 ++----- engines/xeen/font.cpp | 7 +++++++ engines/xeen/font.h | 7 +++++++ engines/xeen/window.h | 8 ++++++++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/engines/xeen/dialogs_input.cpp b/engines/xeen/dialogs_input.cpp index a0573d20ef..8346c8e47b 100644 --- a/engines/xeen/dialogs_input.cpp +++ b/engines/xeen/dialogs_input.cpp @@ -120,14 +120,11 @@ Common::KeyCode Input::waitForKey(const Common::String &msg) { void Input::animateCursor() { // Iterate through each frame _cursorAnimIndex = _cursorAnimIndex ? _cursorAnimIndex - 1 : 5; - static const int CURSOR_ANIMATION_IDS[] = { 32, 124, 126, 127, 126, 124 }; + static const char CURSOR_ANIMATION_IDS[] = { 32, 124, 126, 127, 126, 124 }; // Form a string for the cursor and write it out - Common::String cursorStr = Common::String::format("%c", - CURSOR_ANIMATION_IDS[_cursorAnimIndex]); - Common::Point writePos = _window->_writePos; - _window->writeString(cursorStr); + _window->writeCharacter(CURSOR_ANIMATION_IDS[_cursorAnimIndex]); _window->_writePos = writePos; } diff --git a/engines/xeen/font.cpp b/engines/xeen/font.cpp index 1d7dab7e21..3a70c4c8be 100644 --- a/engines/xeen/font.cpp +++ b/engines/xeen/font.cpp @@ -247,6 +247,13 @@ const char *FontSurface::writeString(const Common::String &s, const Common::Rect return _displayString; } +void FontSurface::writeCharacter(char c, const Common::Rect &clipRect) { + Justify justify = _fontJustify; + _fontJustify = JUSTIFY_NONE; + writeString(Common::String::format("%c", c), clipRect); + _fontJustify = justify; +} + char FontSurface::getNextChar() { return *_displayString++ & 0x7f; } diff --git a/engines/xeen/font.h b/engines/xeen/font.h index d4f10d64b9..ca2cf87ad4 100644 --- a/engines/xeen/font.h +++ b/engines/xeen/font.h @@ -96,6 +96,13 @@ public: * justification is set, the message will be written at _writePos */ const char *writeString(const Common::String &s, const Common::Rect &clipRect); + + /** + * Write a charcter to the window + * @param c Character + * @param clipRect Window bounds to display string within + */ + void writeCharacter(char c, const Common::Rect &clipRect); }; } // End of namespace Xeen diff --git a/engines/xeen/window.h b/engines/xeen/window.h index 2389065300..b63943f919 100644 --- a/engines/xeen/window.h +++ b/engines/xeen/window.h @@ -148,6 +148,14 @@ public: const char *writeString(const Common::String &s) { return FontSurface::writeString(s, _innerBounds); } + + /** + * Write a charcter to the window + * @param c Character + */ + void writeCharacter(char c) { + FontSurface::writeCharacter(c, _innerBounds); + } }; } // End of namespace Xeen -- cgit v1.2.3