From 9a4a8ac5eff671b5216f2e17d9876cfae57f8ab7 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Tue, 19 Apr 2016 12:51:15 +0200 Subject: WAGE: Fixed border highlights --- engines/wage/gui.cpp | 19 +++++++++++-------- engines/wage/macwindow.cpp | 21 +++++++++++++++++++-- engines/wage/macwindow.h | 4 ++-- 3 files changed, 32 insertions(+), 12 deletions(-) diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 6f8c7c5efe..ffbd801f89 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -252,9 +252,19 @@ void Gui::draw() { return; } - if (_scene != _engine->_world->_player->_currentScene) + if (!_engine->_world->_player->_currentScene) + return; + + if (_scene != _engine->_world->_player->_currentScene) { _sceneDirty = true; + _scene = _engine->_world->_player->_currentScene; + + _sceneWindow->setDimensions(*_scene->_designBounds); + _sceneWindow->setTitle(_scene->_name); + _consoleWindow->setDimensions(*_scene->_textBounds); + } + if (_sceneDirty || _bordersDirty) { drawDesktop(); _wm.setFullRefresh(true); @@ -286,10 +296,6 @@ void Gui::drawScene() { if (!_sceneDirty && !_bordersDirty) return; - _scene = _engine->_world->_player->_currentScene; - - _sceneWindow->setDimensions(*_scene->_designBounds); - _sceneWindow->setTitle(_scene->_name); _scene->paint(_sceneWindow->getSurface(), 0, 0); _sceneWindow->setDirty(true); @@ -317,7 +323,6 @@ void Gui::drawConsole() { if (!_consoleDirty && !_consoleFullRedraw && !_bordersDirty && !_sceneDirty) return; - _consoleWindow->setDimensions(*_scene->_textBounds); renderConsole(_consoleWindow->getSurface(), Common::Rect(kBorderWidth - 2, kBorderWidth - 2, _scene->_textBounds->width() - kBorderWidth, _scene->_textBounds->height() - kBorderWidth)); _consoleWindow->setDirty(true); @@ -333,8 +338,6 @@ static void consoleWindowCallback(WindowClick click, Common::Event &event, void gui->_consoleWindow->setScroll(scrollPos, scrollSize); - warning("pos: %f size: %f", scrollPos, scrollSize); - return; } } diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp index b9c7f7a664..682045b9c9 100644 --- a/engines/wage/macwindow.cpp +++ b/engines/wage/macwindow.cpp @@ -235,6 +235,24 @@ void MacWindow::drawBorder() { } } +void MacWindow::setHighlight(WindowClick highlightedPart) { + if (_highlightedPart == highlightedPart) + return; + + _highlightedPart = highlightedPart; + _borderIsDirty = true; + } + + void MacWindow::setScroll(float scrollPos, float scrollSize) { + if (_scrollPos == scrollPos && _scrollSize == scrollSize) + return; + + _scrollPos = scrollPos; + _scrollSize = scrollSize; + _borderIsDirty = true; + } + + void MacWindow::drawBox(Graphics::ManagedSurface *g, int x, int y, int w, int h) { Common::Rect r(x, y, x + w + 1, y + h + 1); @@ -277,6 +295,7 @@ bool MacWindow::processEvent(Common::Event &event) { mouseDown(event); break; case Common::EVENT_LBUTTONUP: + setHighlight(kBorderNone); #if 0 { Designed *obj = mouseUp(event.mouse.x, event.mouse.y); @@ -294,7 +313,6 @@ bool MacWindow::processEvent(Common::Event &event) { } void MacWindow::mouseDown(Common::Event &event) { - _innerDims.debugPrint(); if (_innerDims.contains(event.mouse.x, event.mouse.y)) { if (!_callback) return; @@ -304,7 +322,6 @@ void MacWindow::mouseDown(Common::Event &event) { } WindowClick click = isInBorder(_innerDims, event.mouse.x, event.mouse.y); - warning("click: %d", click); if (click == kBorderNone) return; diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h index af64de21eb..d82807d670 100644 --- a/engines/wage/macwindow.h +++ b/engines/wage/macwindow.h @@ -81,8 +81,8 @@ public: void setActive(bool active); Graphics::ManagedSurface *getSurface() { return &_surface; } void setTitle(Common::String &title) { _title = title; } - void setHighlight(WindowClick highlightedPart) { _highlightedPart = highlightedPart; } - void setScroll(float scrollPos, float scrollSize) { _scrollPos = scrollPos; _scrollSize = scrollSize; _borderIsDirty = true; } + void setHighlight(WindowClick highlightedPart); + void setScroll(float scrollPos, float scrollSize); void setDirty(bool dirty) { _contentIsDirty = dirty; } int getId() { return _id; } bool processEvent(Common::Event &event); -- cgit v1.2.3