diff options
author | Eugene Sandulenko | 2018-03-26 23:54:58 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-03-27 01:07:38 +0200 |
commit | 20c8b949a9a790f7d2b2110587109f9767822de6 (patch) | |
tree | ac4142623cba3c9335ddf076f472e6e3f8dc187c /engines/bladerunner | |
parent | 5e81dc3f8fc08558f76cb81d83e842461cc70d25 (diff) | |
download | scummvm-rg350-20c8b949a9a790f7d2b2110587109f9767822de6.tar.gz scummvm-rg350-20c8b949a9a790f7d2b2110587109f9767822de6.tar.bz2 scummvm-rg350-20c8b949a9a790f7d2b2110587109f9767822de6.zip |
BLADERUNNER: Implement Scores::tick()
Diffstat (limited to 'engines/bladerunner')
-rw-r--r-- | engines/bladerunner/font.cpp | 8 | ||||
-rw-r--r-- | engines/bladerunner/font.h | 1 | ||||
-rw-r--r-- | engines/bladerunner/ui/scores.cpp | 29 |
3 files changed, 38 insertions, 0 deletions
diff --git a/engines/bladerunner/font.cpp b/engines/bladerunner/font.cpp index 5ae1c8eedc..d4b0e16515 100644 --- a/engines/bladerunner/font.cpp +++ b/engines/bladerunner/font.cpp @@ -120,6 +120,14 @@ void Font::drawColor(const Common::String &text, Graphics::Surface &surface, int draw(text, surface, x, y); } +void Font::drawNumber(int num, Graphics::Surface &surface, int x, int y) const { + char buffer[20]; + + snprintf(buffer, 20, "%d", num); + + draw(buffer, surface, x, y); +} + int Font::getTextWidth(const Common::String &text) const { const uint8 *character = (const uint8 *)text.c_str(); diff --git a/engines/bladerunner/font.h b/engines/bladerunner/font.h index 9302520153..4af25468c6 100644 --- a/engines/bladerunner/font.h +++ b/engines/bladerunner/font.h @@ -69,6 +69,7 @@ public: void draw(const Common::String &text, Graphics::Surface &surface, int x, int y) const; void drawColor(const Common::String &text, Graphics::Surface &surface, int x, int y, uint16 color); + void drawNumber(int num, Graphics::Surface &surface, int x, int y) const; int getTextWidth(const Common::String &text) const; int getTextHeight(const Common::String &text) const; diff --git a/engines/bladerunner/ui/scores.cpp b/engines/bladerunner/ui/scores.cpp index 55d3111af4..c97a68d581 100644 --- a/engines/bladerunner/ui/scores.cpp +++ b/engines/bladerunner/ui/scores.cpp @@ -128,6 +128,35 @@ int Scores::handleMouseDown(int x, int y) { } void Scores::tick() { + if (!_vm->_gameIsRunning) { + return; + } + + int frame = _vqaPlayer->update(); + assert(frame >= -1); + + // vqaPlayer renders to _surfaceBack + blit(_vm->_surfaceBack, _vm->_surfaceFront); + + _vm->_surfaceFront.hLine(200, 139, 400, 0x3e0); + _vm->_surfaceFront.hLine(200, 347, 400, 0x1f); + + _font->draw(_txtScorers->getText(7), _vm->_surfaceFront, 200, 114); + + int y = 140; + + for (int i = 0; i < 7; i++) { + _font->draw(_txtScorers->getText(_scorers[i]), _vm->_surfaceFront, 220, y); + _font->drawNumber(_scores[i], _vm->_surfaceFront, 360, y); + + y += 26; + } + + _font->draw(_txtScorers->getText(8), _vm->_surfaceFront, 200, 322); + _font->draw(_txtScorers->getText(_lastScoreId), _vm->_surfaceFront, 220, 348); + _font->drawNumber(_lastScoreValue, _vm->_surfaceFront, 360, 348); + + _vm->blitToScreen(_vm->_surfaceFront); } void Scores::fill() { |