diff options
author | Eugene Sandulenko | 2016-01-02 02:53:30 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-01-02 02:53:30 +0100 |
commit | 8d6e8118423088ba5c126e2cedf79bb3f41492f6 (patch) | |
tree | 1a6aed2521dbb0075c0c023233cd0f27ba785367 /engines/wage | |
parent | 31e4f810c6b9a3d8ab7b202f4ceb73f699e38d08 (diff) | |
download | scummvm-rg350-8d6e8118423088ba5c126e2cedf79bb3f41492f6.tar.gz scummvm-rg350-8d6e8118423088ba5c126e2cedf79bb3f41492f6.tar.bz2 scummvm-rg350-8d6e8118423088ba5c126e2cedf79bb3f41492f6.zip |
WAGE: Redraw Gui parts on demand
Diffstat (limited to 'engines/wage')
-rw-r--r-- | engines/wage/gui.cpp | 29 | ||||
-rw-r--r-- | engines/wage/gui.h | 2 |
2 files changed, 21 insertions, 10 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index c2b0223398..92f05f0251 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -121,7 +121,9 @@ Gui::Gui(WageEngine *engine) { _engine = engine; _scene = NULL; _sceneDirty = true; + _consoleDirty = true; _bordersDirty = true; + _menuDirty = true; _screen.create(g_system->getWidth(), g_system->getHeight(), Graphics::PixelFormat::createFormatCLUT8()); Patterns p; @@ -153,6 +155,8 @@ void Gui::clearOutput() { } void Gui::appendText(String &str) { + _consoleDirty = true; + if (!str.contains('\n')) { _out.push_back(str); return; @@ -178,6 +182,7 @@ void Gui::appendText(String &str) { void Gui::draw() { if (_scene != _engine->_world->_player->_currentScene || _sceneDirty) { _scene = _engine->_world->_player->_currentScene; + _sceneDirty = true; _scene->paint(&_screen, 0 + kComponentsPadding, kMenuHeight + kComponentsPadding); @@ -185,10 +190,13 @@ void Gui::draw() { _sceneArea.top = kMenuHeight + kComponentsPadding + kBorderWidth; _sceneArea.setWidth(_scene->_design->getBounds()->width() - 2 * kBorderWidth); _sceneArea.setHeight(_scene->_design->getBounds()->height() - 2 * kBorderWidth); - - _sceneDirty = false; } + if (_scene && (_bordersDirty || _sceneDirty)) + paintBorder(&_screen, 0 + kComponentsPadding, kMenuHeight + kComponentsPadding, _scene->_design->getBounds()->width(), _scene->_design->getBounds()->height(), + kWindowScene); + + // Render console int sceneW = _scene->_design->getBounds()->width(); int consoleW = _screen.w - sceneW - 2 * kComponentsPadding; @@ -196,18 +204,19 @@ void Gui::draw() { int consoleX = sceneW + kComponentsPadding; int consoleY = kMenuHeight + kComponentsPadding; - renderConsole(&_screen, consoleX + kBorderWidth , consoleY + kBorderWidth, consoleW - 2 * kBorderWidth, consoleH - 2 * kBorderWidth); + if (_consoleDirty) + renderConsole(&_screen, consoleX + kBorderWidth , consoleY + kBorderWidth, consoleW - 2 * kBorderWidth, consoleH - 2 * kBorderWidth); - if (_bordersDirty) { - if (_scene) - paintBorder(&_screen, 0 + kComponentsPadding, kMenuHeight + kComponentsPadding, _scene->_design->getBounds()->width(), _scene->_design->getBounds()->height(), - kWindowScene); + if (_bordersDirty || _consoleDirty) paintBorder(&_screen, consoleX, consoleY, consoleW, consoleH, kWindowConsole); - _bordersDirty = false; - } + if (_menuDirty) + renderMenu(); - renderMenu(); + _sceneDirty = false; + _consoleDirty = false; + _bordersDirty = false; + _menuDirty = false; // Blit to screen g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, _screen.w, _screen.h); diff --git a/engines/wage/gui.h b/engines/wage/gui.h index dc04e90c17..2fa9e7ab27 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -84,7 +84,9 @@ private: Graphics::Surface _console; Scene *_scene; bool _sceneDirty; + bool _consoleDirty; bool _bordersDirty; + bool _menuDirty; Common::StringArray _out; Common::StringArray _lines; |