GRAPHICS: MACGUI: add intersection check with macmenu and macwindow
This commit is contained in:
parent
1b211371cf
commit
60d9b79c0f
3 changed files with 24 additions and 1 deletions
|
@ -1038,6 +1038,15 @@ bool MacMenu::keyEvent(Common::Event &event) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool MacMenu::checkIntersects(Common::Rect &rect) {
|
||||
if (_bbox.intersects(rect))
|
||||
return true;
|
||||
for (uint i = 0; i < _menustack.size(); i++)
|
||||
if (_menustack[i]->bbox.intersects(rect))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MacMenu::mouseClick(int x, int y) {
|
||||
if (_bbox.contains(x, y)) {
|
||||
for (uint i = 0; i < _items.size(); i++) {
|
||||
|
|
|
@ -95,6 +95,8 @@ public:
|
|||
|
||||
void closeMenu();
|
||||
|
||||
bool checkIntersects(Common::Rect &rect);
|
||||
|
||||
Common::Rect _bbox;
|
||||
|
||||
private:
|
||||
|
|
|
@ -657,7 +657,19 @@ void MacWindowManager::draw() {
|
|||
|
||||
// Menu is drawn on top of everything and always
|
||||
if (_menu && !(_mode & kWMModeFullscreen)) {
|
||||
_menu->draw(_screen, _fullRefresh);
|
||||
if (_fullRefresh)
|
||||
_menu->draw(_screen, _fullRefresh);
|
||||
else {
|
||||
// add intersection check with menu
|
||||
bool menuRedraw = false;
|
||||
for (Common::Array<Common::Rect>::iterator dirty = dirtyRects.begin(); dirty != dirtyRects.end(); dirty++) {
|
||||
if (_menu->checkIntersects(*dirty)) {
|
||||
menuRedraw = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
_menu->draw(_screen, menuRedraw);
|
||||
}
|
||||
}
|
||||
|
||||
_fullRefresh = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue