aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-04-25 19:47:08 +0200
committerEugene Sandulenko2016-04-25 19:47:08 +0200
commitdf6ee166311e47e77d2b50aee87e233412f6d23a (patch)
tree27fa418f2637aa34c8715ce53484bd00339120b5 /engines
parent3a9159c5a34c891b10ff6b44d6982eda717e48f7 (diff)
downloadscummvm-rg350-df6ee166311e47e77d2b50aee87e233412f6d23a.tar.gz
scummvm-rg350-df6ee166311e47e77d2b50aee87e233412f6d23a.tar.bz2
scummvm-rg350-df6ee166311e47e77d2b50aee87e233412f6d23a.zip
WAGE: Moved menu rendering to WindowManager
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/gui.cpp31
-rw-r--r--engines/wage/gui.h2
-rw-r--r--engines/wage/macwindowmanager.cpp15
-rw-r--r--engines/wage/macwindowmanager.h2
-rw-r--r--engines/wage/menu.cpp11
-rw-r--r--engines/wage/wage.cpp1
6 files changed, 31 insertions, 31 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 8aaad70cd3..92002fff5a 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -150,7 +150,6 @@ Gui::Gui(WageEngine *engine) {
_scene = NULL;
_sceneDirty = true;
_consoleDirty = true;
- _menuDirty = true;
_cursorDirty = false;
_consoleFullRedraw = true;
_screen.create(g_system->getWidth(), g_system->getHeight(), Graphics::PixelFormat::createFormatCLUT8());
@@ -200,7 +199,6 @@ Gui::~Gui() {
_screen.free();
_console.free();
g_system->getTimerManager()->removeTimerProc(&cursorTimerHandler);
- delete _menu;
}
void Gui::undrawCursor() {
@@ -232,13 +230,7 @@ const Graphics::Font *Gui::getTitleFont() {
void Gui::draw() {
if (_engine->_isGameOver) {
- if (_menuDirty) {
- _wm.setFullRefresh(true);
- _wm.draw();
- _menu->draw(&_screen);
- }
-
- _menuDirty = false;
+ _wm.draw();
return;
}
@@ -263,9 +255,6 @@ void Gui::draw() {
_wm.draw();
- if (_menuDirty)
- _menu->draw(&_screen);
-
if (_cursorDirty && _cursorRect.left < _screen.w && _cursorRect.bottom < _screen.h) {
g_system->copyRectToScreen(_screen.getBasePtr(_cursorRect.left, _cursorRect.top), _screen.pitch,
_cursorRect.left, _cursorRect.top, _cursorRect.width(), _cursorRect.height());
@@ -275,7 +264,6 @@ void Gui::draw() {
_sceneDirty = false;
_consoleDirty = false;
- _menuDirty = false;
_consoleFullRedraw = false;
}
@@ -288,7 +276,7 @@ void Gui::drawScene() {
_sceneDirty = true;
_consoleDirty = true;
- _menuDirty = true;
+ _menu->setDirty(true);
_consoleFullRedraw = true;
}
@@ -489,7 +477,7 @@ void Gui::processMenuShortCut(byte flags, uint16 ascii) {
void Gui::mouseMove(int x, int y) {
if (_menu->hasAllFocus()) {
if (_menu->mouseMove(x, y))
- _menuDirty = true;
+ _menu->setDirty(true);
return;
}
@@ -526,22 +514,15 @@ bool Gui::processEvent(Common::Event &event) {
}
void Gui::mouseUp(int x, int y) {
- if (_menu->hasAllFocus()) {
- if (_menu->mouseRelease(x, y)) {
- _sceneDirty = true;
- _consoleDirty = true;
- _menuDirty = true;
- }
-
- return;
- }
+ if (_menu->hasAllFocus())
+ _menu->mouseRelease(x, y);
return;
}
void Gui::mouseDown(int x, int y) {
if (_menu->mouseClick(x, y)) {
- _menuDirty = true;
+ _menu->setDirty(true);
}
}
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 2feb259e9f..bec308d38c 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -146,8 +146,6 @@ public:
Common::Rect _cursorRect;
bool _cursorOff;
- bool _menuDirty;
-
Scene *_scene;
MacWindowManager _wm;
diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp
index de75555273..f099342f4b 100644
--- a/engines/wage/macwindowmanager.cpp
+++ b/engines/wage/macwindowmanager.cpp
@@ -74,6 +74,8 @@ MacWindowManager::MacWindowManager() {
_lastId = 0;
_activeWindow = -1;
+ _menu = 0;
+
_fullRefresh = true;
for (int i = 0; i < ARRAYSIZE(fillPatterns); i++)
@@ -99,13 +101,13 @@ MacWindow *MacWindowManager::addWindow(bool scrollable, bool resizable) {
}
Menu *MacWindowManager::addMenu(Gui *g) {
- Menu *m = new Menu(_lastId, g);
+ _menu = new Menu(_lastId, g);
- _windows.push_back(m);
+ _windows.push_back(_menu);
_lastId++;
- return m;
+ return _menu;
}
void MacWindowManager::setActive(int id) {
@@ -143,6 +145,10 @@ void MacWindowManager::draw() {
}
}
+ // Menu is drawn on top of everything and always
+ if (_menu)
+ _menu->draw(_screen, _fullRefresh);
+
_fullRefresh = false;
}
@@ -154,6 +160,9 @@ void MacWindowManager::drawDesktop() {
}
bool MacWindowManager::processEvent(Common::Event &event) {
+ if (_menu && _menu->processEvent(event))
+ return true;
+
if (event.type != Common::EVENT_MOUSEMOVE && event.type != Common::EVENT_LBUTTONDOWN &&
event.type != Common::EVENT_LBUTTONUP)
return false;
diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h
index 0d0ade03ab..91d426e9d9 100644
--- a/engines/wage/macwindowmanager.h
+++ b/engines/wage/macwindowmanager.h
@@ -87,6 +87,8 @@ private:
bool _fullRefresh;
Patterns _patterns;
+
+ Menu *_menu;
};
} // End of namespace Wage
diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp
index 198bdf3d40..40dbbbbf50 100644
--- a/engines/wage/menu.cpp
+++ b/engines/wage/menu.cpp
@@ -341,6 +341,11 @@ void Menu::calcMenuBounds(MenuItem *menu) {
bool Menu::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
Common::Rect r(_bbox);
+ if (!_contentIsDirty)
+ return false;
+
+ _contentIsDirty = true;
+
Design::drawFilledRoundRect(&_gui->_screen, r, kDesktopArc, kColorWhite, _gui->_patterns, kPatternSolid);
r.top = 7;
Design::drawFilledRect(&_gui->_screen, r, kColorWhite, _gui->_patterns, kPatternSolid);
@@ -506,6 +511,8 @@ bool Menu::mouseRelease(int x, int y) {
_activeItem = -1;
_activeSubItem = -1;
+ _gui->_wm.setFullRefresh(true);
+
return true;
}
@@ -566,12 +573,16 @@ void Menu::enableCommand(int menunum, int action, bool state) {
for (uint i = 0; i < _items[menunum]->subitems.size(); i++)
if (_items[menunum]->subitems[i]->action == action)
_items[menunum]->subitems[i]->enabled = state;
+
+ _contentIsDirty = true;
}
void Menu::disableAllMenus() {
for (uint i = 1; i < _items.size(); i++) // Leave About menu on
for (uint j = 0; j < _items[i]->subitems.size(); j++)
_items[i]->subitems[j]->enabled = false;
+
+ _contentIsDirty = true;
}
} // End of namespace Wage
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index 278badd616..be79b14b62 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -227,7 +227,6 @@ void WageEngine::gameOver() {
_gui->disableAllMenus();
_gui->enableNewGameMenus();
- _gui->_menuDirty = true;
}
bool WageEngine::saveDialog() {