XEEN: Fix animated text cursor partialy overlapping prior char

This commit is contained in:
Paul Gilbert 2017-12-24 09:44:15 -05:00
parent ee1da05d0b
commit 6b5eab62f6
4 changed files with 24 additions and 5 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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

View file

@ -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