From 068d8791e8ecd0c47abb18fab1836dbe99cb9374 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 8 Jan 2020 01:09:55 +0100 Subject: DIRECTOR: Invert button on mouse down --- engines/director/frame.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'engines/director') diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp index 8d27eed5de..ad12406a6d 100644 --- a/engines/director/frame.cpp +++ b/engines/director/frame.cpp @@ -781,9 +781,7 @@ void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId) { int height = button->_initialRect.height(); int width = button->_initialRect.width() + 3; - Common::Rect textRect(0, 0, width, height); - // pass the rect of the button into the label. - renderText(surface, spriteId, &textRect); + bool invert = spriteId == _vm->getCurrentScore()->_currentMouseDownSpriteId; // TODO: review all cases to confirm if we should use text height. // height = textRect.height(); @@ -799,8 +797,9 @@ void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId) { break; case kTypeButton: { _rect = Common::Rect(x, y, x + width, y + height + 3); - Graphics::MacPlotData pd(&surface, &_vm->getMacWindowManager()->getPatterns(), Graphics::MacGUIConstants::kPatternSolid, 1, Graphics::kColorWhite); - Graphics::drawRoundRect(_rect, 4, 0, false, Graphics::macDrawPixel, &pd); + Graphics::MacPlotData pd(&surface, &_vm->getMacWindowManager()->getPatterns(), Graphics::MacGUIConstants::kPatternSolid, 1, invert ? Graphics::kColorBlack : Graphics::kColorWhite); + + Graphics::drawRoundRect(_rect, 4, 0, invert, Graphics::macDrawPixel, &pd); addDrawRect(spriteId, _rect); } break; @@ -811,6 +810,10 @@ void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId) { warning("renderButton: Unknown buttonType"); break; } + + Common::Rect textRect(0, 0, width, height); + // pass the rect of the button into the label. + renderText(surface, spriteId, &textRect); } void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Common::Rect *textRect) { @@ -933,7 +936,12 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo textWithFeatures.transBlitFrom(textSurface->rawSurface(), Common::Point(textX, textY), 0xff); - inkBasedBlit(surface, textWithFeatures, _sprites[spriteId]->_ink, Common::Rect(x, y, x + width, y + height)); + InkType ink = _sprites[spriteId]->_ink; + + if (spriteId == _vm->getCurrentScore()->_currentMouseDownSpriteId) + ink = kInkTypeReverse; + + inkBasedBlit(surface, textWithFeatures, ink, Common::Rect(x, y, x + width, y + height)); } void Frame::inkBasedBlit(Graphics::ManagedSurface &targetSurface, const Graphics::Surface &spriteSurface, InkType ink, Common::Rect drawRect) { -- cgit v1.2.3