WAGE: Fixed border highlights

This commit is contained in:
Eugene Sandulenko 2016-04-19 12:51:15 +02:00
parent 6f03947bc9
commit 9a4a8ac5ef
3 changed files with 32 additions and 12 deletions

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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);