aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision
diff options
context:
space:
mode:
authorrichiesams2013-08-26 14:15:10 -0500
committerrichiesams2013-08-28 16:44:23 -0500
commite3b08793dddbf8cf8214328b4b3780995496645c (patch)
tree4ac3f0f5fa08b10d5f551a8b3eae50030c613056 /engines/zvision
parenta6b2bb75819554a779b238045c21867943ce5f6c (diff)
downloadscummvm-rg350-e3b08793dddbf8cf8214328b4b3780995496645c.tar.gz
scummvm-rg350-e3b08793dddbf8cf8214328b4b3780995496645c.tar.bz2
scummvm-rg350-e3b08793dddbf8cf8214328b4b3780995496645c.zip
ZVISION: Add ScriptManager mouse event handlers
This allows the main engine to pass mouse events to Controls
Diffstat (limited to 'engines/zvision')
-rw-r--r--engines/zvision/script_manager.cpp19
-rw-r--r--engines/zvision/script_manager.h23
2 files changed, 42 insertions, 0 deletions
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp
index 3cc4c92f0b..98bc2e3a3a 100644
--- a/engines/zvision/script_manager.cpp
+++ b/engines/zvision/script_manager.cpp
@@ -233,6 +233,25 @@ void ScriptManager::disableControl(uint32 key) {
}
}
+void ScriptManager::onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
+ for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
+ (*iter)->onMouseDown(screenSpacePos, backgroundImageSpacePos);
+ }
+}
+
+void ScriptManager::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
+ for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
+ (*iter)->onMouseUp(screenSpacePos, backgroundImageSpacePos);
+ }
+}
+
+bool ScriptManager::onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
+ bool cursorWasChanged = false;
+ for (Common::List<Control *>::iterator iter = _activeControls.begin(); iter != _activeControls.end(); iter++) {
+ cursorWasChanged = cursorWasChanged || (*iter)->onMouseMove(screenSpacePos, backgroundImageSpacePos);
+ }
+
+ return cursorWasChanged;
}
void ScriptManager::changeLocation(char world, char room, char node, char view, uint32 offset) {
diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h
index 0f3ea43dc3..9b4763764f 100644
--- a/engines/zvision/script_manager.h
+++ b/engines/zvision/script_manager.h
@@ -86,6 +86,29 @@ public:
void enableControl(uint32 key);
void disableControl(uint32 key);
+ /**
+ * Called when LeftMouse is pushed.
+ *
+ * @param screenSpacePos The position of the mouse in screen space
+ * @param backgroundImageSpacePos The position of the mouse in background image space
+ */
+ void onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos);
+ /**
+ * Called when LeftMouse is lifted.
+ *
+ * @param screenSpacePos The position of the mouse in screen space
+ * @param backgroundImageSpacePos The position of the mouse in background image space
+ */
+ void onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos);
+ /**
+ * Called on every MouseMove.
+ *
+ * @param screenSpacePos The position of the mouse in screen space
+ * @param backgroundImageSpacePos The position of the mouse in background image space
+ * @return Was the cursor changed?
+ */
+ bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos);
+
void changeLocation(char world, char room, char node, char view, uint32 offset);
private: