diff options
author | Filippos Karapetis | 2009-10-07 21:29:47 +0000 |
---|---|---|
committer | Filippos Karapetis | 2009-10-07 21:29:47 +0000 |
commit | 1562add63191c482acf99da61d6d8d1e2bf8903d (patch) | |
tree | 68d36e8e9219837a9febdb7791b572da9e7f3ed6 /engines/sci/engine/kevent.cpp | |
parent | 80d136a362e667d4e8ff0754fe634eba30e0590a (diff) | |
download | scummvm-rg350-1562add63191c482acf99da61d6d8d1e2bf8903d.tar.gz scummvm-rg350-1562add63191c482acf99da61d6d8d1e2bf8903d.tar.bz2 scummvm-rg350-1562add63191c482acf99da61d6d8d1e2bf8903d.zip |
- Cleaned up the cursor code
- Renamed gui -> _gui in EngineState, for consistency
- Added a reference to SciGuiCursor in EngineState, to be used by current code
- Renamed setCursorHide -> hideCursor, setCursorShow -> showCursor
- Moved the cursor zone limiting code inside SciGuiCursor. This code is currently not functioning, as we need to call refreshPosition() before each updateScreen() call to limit the cursor position.
svn-id: r44760
Diffstat (limited to 'engines/sci/engine/kevent.cpp')
-rw-r--r-- | engines/sci/engine/kevent.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index b8af6f0ab0..33a0103d6f 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -31,6 +31,7 @@ #include "sci/console.h" #include "sci/debug.h" // for g_debug_simulated_key #include "sci/gui/gui.h" +#include "sci/gui/gui_cursor.h" namespace Sci { @@ -43,6 +44,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { int oldx, oldy; int modifier_mask = getSciVersion() <= SCI_VERSION_01 ? SCI_EVM_ALL : SCI_EVM_NO_FOOLOCK; SegManager *segMan = s->_segMan; + Common::Point mousePos = s->_cursor->getPosition(); // If there's a simkey pending, and the game wants a keyboard event, use the // simkey instead of a normal event @@ -50,22 +52,22 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { PUT_SEL32V(obj, type, SCI_EVT_KEYBOARD); // Keyboard event PUT_SEL32V(obj, message, g_debug_simulated_key); PUT_SEL32V(obj, modifiers, SCI_EVM_NUMLOCK); // Numlock on - PUT_SEL32V(obj, x, s->gfx_state->pointer_pos.x); - PUT_SEL32V(obj, y, s->gfx_state->pointer_pos.y); + PUT_SEL32V(obj, x, mousePos.x); + PUT_SEL32V(obj, y, mousePos.y); g_debug_simulated_key = 0; return make_reg(0, 1); } - oldx = s->gfx_state->pointer_pos.x; - oldy = s->gfx_state->pointer_pos.y; + oldx = mousePos.x; + oldy = mousePos.y; e = gfxop_get_event(s->gfx_state, mask); s->parser_event = NULL_REG; // Invalidate parser event - PUT_SEL32V(obj, x, s->gfx_state->pointer_pos.x); - PUT_SEL32V(obj, y, s->gfx_state->pointer_pos.y); + PUT_SEL32V(obj, x, mousePos.x); + PUT_SEL32V(obj, y, mousePos.y); - //s->gui->moveCursor(s->gfx_state->pointer_pos.x, s->gfx_state->pointer_pos.y); + //s->_gui->moveCursor(s->gfx_state->pointer_pos.x, s->gfx_state->pointer_pos.y); switch (e.type) { case SCI_EVT_QUIT: @@ -94,11 +96,12 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) { case SCI_EVT_MOUSE_RELEASE: case SCI_EVT_MOUSE_PRESS: { int extra_bits = 0; + Common::Point mousePos = s->_cursor->getPosition(); // track left buttton clicks, if requested if (e.type == SCI_EVT_MOUSE_PRESS && e.data == 1 && g_debug_track_mouse_clicks) { ((SciEngine *)g_engine)->getSciDebugger()->DebugPrintf("Mouse clicked at %d, %d\n", - s->gfx_state->pointer_pos.x, s->gfx_state->pointer_pos.y); + mousePos.x, mousePos.y); } if (mask & e.type) { @@ -210,7 +213,7 @@ reg_t kGlobalToLocal(EngineState *s, int argc, reg_t *argv) { int16 x = GET_SEL32V(obj, x); int16 y = GET_SEL32V(obj, y); - s->gui->globalToLocal(&x, &y); + s->_gui->globalToLocal(&x, &y); PUT_SEL32V(obj, x, x); PUT_SEL32V(obj, y, y); @@ -228,7 +231,7 @@ reg_t kLocalToGlobal(EngineState *s, int argc, reg_t *argv) { int16 x = GET_SEL32V(obj, x); int16 y = GET_SEL32V(obj, y); - s->gui->localToGlobal(&x, &y); + s->_gui->localToGlobal(&x, &y); PUT_SEL32V(obj, x, x); PUT_SEL32V(obj, y, y); |