diff options
author | Nipun Garg | 2019-06-28 18:02:14 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:03 +0200 |
commit | 178bb473c1b891403972aef976901e0ddd252fba (patch) | |
tree | d73cec3b3fec03d217c43b9a4d6fc4a89b604fe5 /engines/hdb | |
parent | 48428a75b7d0061f183733cd5a386ef5b5718cee (diff) | |
download | scummvm-rg350-178bb473c1b891403972aef976901e0ddd252fba.tar.gz scummvm-rg350-178bb473c1b891403972aef976901e0ddd252fba.tar.bz2 scummvm-rg350-178bb473c1b891403972aef976901e0ddd252fba.zip |
HDB: Add _textOutList functions
Diffstat (limited to 'engines/hdb')
-rw-r--r-- | engines/hdb/window.cpp | 51 | ||||
-rw-r--r-- | engines/hdb/window.h | 8 |
2 files changed, 59 insertions, 0 deletions
diff --git a/engines/hdb/window.cpp b/engines/hdb/window.cpp index 09d8866445..aa10fdef1b 100644 --- a/engines/hdb/window.cpp +++ b/engines/hdb/window.cpp @@ -384,4 +384,55 @@ void Window::drawInventory() { } } +void Window::textOut(const char *text, int x, int y, int timer) { + TOut *t = new TOut; + + t->x = x; + t->y = y; + strcpy(t->text, text); + t->timer = g_system->getMillis() + (uint32)(timer << 4); + + if (x < 0) { + int pw, lines; + g_hdb->_drawMan->getDimensions(t->text, &pw, &lines); + t->x = kTextOutCenterX - pw / 2; + } +} + +void Window::centerTextOut(const char *text, int y, int timer) { + int width, lines; + g_hdb->_drawMan->getDimensions(text, &width, &lines); + textOut(text, kTextOutCenterX - ((width - 8) >> 1), y, timer); +} + +void Window::drawTextOut() { + int e1, e2, e3, e4; + uint32 time; + TOut *t; + + if (_textOutList.empty()) + return; + + g_hdb->_drawMan->getTextEdges(&e1, &e2, &e3, &e4); + g_hdb->_drawMan->setTextEdges(0, 480, 0, kScreenHeight); + + time = g_system->getMillis(); + + for (uint i = 0; i < _textOutList.size(); i++) { + t = _textOutList[i]; + g_hdb->_drawMan->setCursor(t->x, t->y); + g_hdb->_drawMan->drawText(t->text); + + if (t->timer < time) { + _textOutList.remove_at(i); + i--; + } + } + + g_hdb->_drawMan->setTextEdges(e1, e2, e3, e4); +} + +void Window::closeTextOut() { + _textOutList.clear(); +} } // End of Namespace diff --git a/engines/hdb/window.h b/engines/hdb/window.h index b8033702ba..b2d2a3eb4b 100644 --- a/engines/hdb/window.h +++ b/engines/hdb/window.h @@ -101,6 +101,14 @@ public: return _invWinInfo.selection; } + // TextOut functions + void textOut(const char *text, int x, int y, int timer); + void centerTextOut(const char *text, int y, int timer); + void drawTextOut(); + int textOutActive() { + return (_textOutList.size()); + } + void closeTextOut(); private: DialogInfo _dialogInfo; |