aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/graphics/cursor.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2010-02-05 21:09:36 +0000
committerMartin Kiewitz2010-02-05 21:09:36 +0000
commitf9673182254d2a3ea4bb770ce031d89985c8cba9 (patch)
treef79a2408d9b051a7b478486b996d764e878c9554 /engines/sci/graphics/cursor.cpp
parent16efee3c0df7e796b21ec198064a8499d2a28dac (diff)
downloadscummvm-rg350-f9673182254d2a3ea4bb770ce031d89985c8cba9.tar.gz
scummvm-rg350-f9673182254d2a3ea4bb770ce031d89985c8cba9.tar.bz2
scummvm-rg350-f9673182254d2a3ea4bb770ce031d89985c8cba9.zip
SCI: remaining cursor functions now also directly called
svn-id: r47914
Diffstat (limited to 'engines/sci/graphics/cursor.cpp')
-rw-r--r--engines/sci/graphics/cursor.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/engines/sci/graphics/cursor.cpp b/engines/sci/graphics/cursor.cpp
index 5de0166c98..ac4ef0a227 100644
--- a/engines/sci/graphics/cursor.cpp
+++ b/engines/sci/graphics/cursor.cpp
@@ -28,9 +28,11 @@
#include "common/events.h"
#include "sci/sci.h"
+#include "sci/event.h"
#include "sci/engine/state.h"
#include "sci/graphics/palette.h"
#include "sci/graphics/screen.h"
+#include "sci/graphics/coordadjuster.h"
#include "sci/graphics/view.h"
#include "sci/graphics/cursor.h"
@@ -42,7 +44,7 @@ GfxCursor::GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *sc
_upscaledHires = _screen->getUpscaledHires();
// center mouse cursor
setPosition(Common::Point(_screen->getDisplayWidth() / 2, _screen->getDisplayHeight() / 2));
- setMoveZone(Common::Rect(0, 0, _screen->getDisplayWidth(), _screen->getDisplayHeight()));
+ kernelSetMoveZone(Common::Rect(0, 0, _screen->getDisplayWidth(), _screen->getDisplayHeight()));
_isVisible = true;
}
@@ -51,6 +53,11 @@ GfxCursor::~GfxCursor() {
purgeCache();
}
+void GfxCursor::init(GfxCoordAdjuster *coordAdjuster, SciEvent *event) {
+ _coordAdjuster = coordAdjuster;
+ _event = event;
+}
+
void GfxCursor::kernelShow() {
CursorMan.showMouse(true);
_isVisible = true;
@@ -224,4 +231,27 @@ void GfxCursor::refreshPosition() {
setPosition(mousePoint);
}
+void GfxCursor::kernelSetMoveZone(Common::Rect zone) {
+ _moveZone = zone;
+}
+
+void GfxCursor::kernelSetPos(Common::Point pos) {
+ _coordAdjuster->setCursorPos(pos);
+ kernelMoveCursor(pos);
+}
+
+void GfxCursor::kernelMoveCursor(Common::Point pos) {
+ _coordAdjuster->moveCursor(pos);
+ if (pos.x > _screen->getWidth() || pos.y > _screen->getHeight()) {
+ warning("attempt to place cursor at invalid coordinates (%d, %d)", pos.y, pos.x);
+ return;
+ }
+
+ setPosition(pos);
+
+ // Trigger event reading to make sure the mouse coordinates will
+ // actually have changed the next time we read them.
+ _event->get(SCI_EVENT_PEEK);
+}
+
} // End of namespace Sci