aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/window.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-06-28 18:02:14 +0530
committerEugene Sandulenko2019-09-03 17:17:03 +0200
commit178bb473c1b891403972aef976901e0ddd252fba (patch)
treed73cec3b3fec03d217c43b9a4d6fc4a89b604fe5 /engines/hdb/window.cpp
parent48428a75b7d0061f183733cd5a386ef5b5718cee (diff)
downloadscummvm-rg350-178bb473c1b891403972aef976901e0ddd252fba.tar.gz
scummvm-rg350-178bb473c1b891403972aef976901e0ddd252fba.tar.bz2
scummvm-rg350-178bb473c1b891403972aef976901e0ddd252fba.zip
HDB: Add _textOutList functions
Diffstat (limited to 'engines/hdb/window.cpp')
-rw-r--r--engines/hdb/window.cpp51
1 files changed, 51 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