From 553d32a81808844eefbb603fb09adff7e96234ef Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Thu, 1 Dec 2011 23:52:47 +0100 Subject: MOHAWK: Implement LBCode::cmdMousePos. --- engines/mohawk/livingbooks_code.cpp | 11 ++++++++++- engines/mohawk/livingbooks_code.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'engines') 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 ¶ms) { _stack.push(Common::Point(rect.bottom, rect.right)); } +void LBCode::cmdMousePos(const Common::Array ¶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 ¶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 ¶ms); void cmdTopLeft(const Common::Array ¶ms); void cmdBottomRight(const Common::Array ¶ms); + void cmdMousePos(const Common::Array ¶ms); void cmdTop(const Common::Array ¶ms); void cmdLeft(const Common::Array ¶ms); void cmdBottom(const Common::Array ¶ms); -- cgit v1.2.3