diff options
-rw-r--r-- | engines/mohawk/livingbooks_code.cpp | 11 | ||||
-rw-r--r-- | engines/mohawk/livingbooks_code.h | 1 |
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> ¶ms) { _stack.push(Common::Point(rect.bottom, rect.right)); } +void LBCode::cmdMousePos(const Common::Array<LBValue> ¶ms) { + 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> ¶ms) { 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> ¶ms); void cmdTopLeft(const Common::Array<LBValue> ¶ms); void cmdBottomRight(const Common::Array<LBValue> ¶ms); + void cmdMousePos(const Common::Array<LBValue> ¶ms); void cmdTop(const Common::Array<LBValue> ¶ms); void cmdLeft(const Common::Array<LBValue> ¶ms); void cmdBottom(const Common::Array<LBValue> ¶ms); |