aboutsummaryrefslogtreecommitdiff
path: root/engines/wage/gui.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2016-04-19 10:37:53 +0200
committerEugene Sandulenko2016-04-19 10:37:53 +0200
commitfd7bf64131a0f1ecc5f3b4039c481fff52eb6efa (patch)
tree092ffce1e890a20636a17eeb934f3bfea4d32f40 /engines/wage/gui.cpp
parent609dd56b136db3e0bdfc7906bdc386403e4a1192 (diff)
downloadscummvm-rg350-fd7bf64131a0f1ecc5f3b4039c481fff52eb6efa.tar.gz
scummvm-rg350-fd7bf64131a0f1ecc5f3b4039c481fff52eb6efa.tar.bz2
scummvm-rg350-fd7bf64131a0f1ecc5f3b4039c481fff52eb6efa.zip
WAGE: Switched event processing to generic code
Diffstat (limited to 'engines/wage/gui.cpp')
-rw-r--r--engines/wage/gui.cpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 8833f7f63d..5bb342fcab 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -55,10 +55,10 @@
#include "wage/wage.h"
#include "wage/design.h"
#include "wage/entities.h"
+#include "wage/gui.h"
#include "wage/macwindow.h"
#include "wage/macwindowmanager.h"
#include "wage/menu.h"
-#include "wage/gui.h"
#include "wage/world.h"
namespace Wage {
@@ -540,6 +540,32 @@ void Gui::popCursor() {
CursorMan.popCursor();
}
+bool Gui::processEvent(Common::Event &event) {
+ if (_wm.processEvent(event))
+ return true;
+
+ switch (event.type) {
+ case Common::EVENT_MOUSEMOVE:
+ mouseMove(event.mouse.x, event.mouse.y);
+ break;
+ case Common::EVENT_LBUTTONDOWN:
+ mouseDown(event.mouse.x, event.mouse.y);
+ break;
+ case Common::EVENT_LBUTTONUP:
+ {
+ Designed *obj = mouseUp(event.mouse.x, event.mouse.y);
+ if (obj != NULL)
+ _engine->processTurn(NULL, obj);
+ }
+ break;
+
+ default:
+ return false;
+ }
+
+ return true;
+}
+
static int isInBorder(Common::Rect &rect, int x, int y) {
if (x >= rect.left - kBorderWidth && x < rect.left && y >= rect.top - kBorderWidth && y < rect.top)
return kBorderCloseButton;
@@ -645,8 +671,6 @@ Designed *Gui::mouseUp(int x, int y) {
void Gui::mouseDown(int x, int y) {
int borderClick;
- _wm.mouseDown(x, y);
-
if (_menu->mouseClick(x, y)) {
_menuDirty = true;
} else if (_consoleTextArea.contains(x, y)) {