aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mohawk/livingbooks_code.cpp11
-rw-r--r--engines/mohawk/livingbooks_code.h1
2 files changed, 11 insertions, 1 deletions
diff --git a/engines/mohawk/livingbooks_code.cpp b/engines/mohawk/livingbooks_code.cpp
index be4173f67d..caf00c7129 100644
--- a/engines/mohawk/livingbooks_code.cpp
+++ b/engines/mohawk/livingbooks_code.cpp
@@ -24,6 +24,7 @@
#include "mohawk/livingbooks_lbx.h"
#include "mohawk/resource.h"
+#include "common/events.h"
#include "common/system.h"
#include "common/textconsole.h"
@@ -751,7 +752,7 @@ CodeCommandInfo generalCommandInfo[NUM_GENERAL_COMMANDS] = {
{ "makePt", &LBCode::cmdMakePoint }, // also "makePair"
{ "topLeft", &LBCode::cmdTopLeft },
{ "bottomRight", &LBCode::cmdBottomRight },
- { "mousePos", 0 },
+ { "mousePos", &LBCode::cmdMousePos },
{ "top", &LBCode::cmdTop },
{ "left", &LBCode::cmdLeft },
{ "bottom", &LBCode::cmdBottom },
@@ -1006,6 +1007,14 @@ void LBCode::cmdBottomRight(const Common::Array<LBValue> &params) {
_stack.push(Common::Point(rect.bottom, rect.right));
}
+void LBCode::cmdMousePos(const Common::Array<LBValue> &params) {
+ if (params.size() != 0)
+ error("too many parameters (%d) to mousePos", params.size());
+
+ Common::Point pt = _vm->_system->getEventManager()->getMousePos();
+ _stack.push(pt);
+}
+
void LBCode::cmdTop(const Common::Array<LBValue> &params) {
if (params.size() > 1)
error("too many parameters (%d) to top", params.size());
diff --git a/engines/mohawk/livingbooks_code.h b/engines/mohawk/livingbooks_code.h
index e866fca0b4..973a674fdd 100644
--- a/engines/mohawk/livingbooks_code.h
+++ b/engines/mohawk/livingbooks_code.h
@@ -257,6 +257,7 @@ public:
void cmdMakePoint(const Common::Array<LBValue> &params);
void cmdTopLeft(const Common::Array<LBValue> &params);
void cmdBottomRight(const Common::Array<LBValue> &params);
+ void cmdMousePos(const Common::Array<LBValue> &params);
void cmdTop(const Common::Array<LBValue> &params);
void cmdLeft(const Common::Array<LBValue> &params);
void cmdBottom(const Common::Array<LBValue> &params);