diff options
author | pixel <pixel> | 2003-03-13 00:58:29 +0000 |
---|---|---|
committer | pixel <pixel> | 2003-03-13 00:58:29 +0000 |
commit | 97ec70da939ace8fa7a076fa31f0d1548e489ba1 (patch) | |
tree | 9e73702332cc808653e7ee863d88626334095015 /lib | |
parent | ed435a3042573e039b2db62fef337211d582a37c (diff) |
lock mouse effect
Diffstat (limited to 'lib')
-rw-r--r-- | lib/engine.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/engine.cc b/lib/engine.cc index 2d53beb..53be179 100644 --- a/lib/engine.cc +++ b/lib/engine.cc @@ -5,7 +5,7 @@ bool mogltk::engine::inited = false, mogltk::engine::postsetuped = false; bool mogltk::engine::appactive = false, mogltk::engine::cursorvisible = false, mogltk::engine::quitrequest = false; int mogltk::engine::mx, mogltk::engine::my, mogltk::engine::mbuttons; -int mogltk::engine::frames; +int mogltk::engine::frames, mogltk::engine::locked = 0; double mogltk::engine::curfps = -1; Uint32 mogltk::engine::curticks; @@ -160,6 +160,11 @@ void mogltk::engine::pollevents() { break; case SDL_MOUSEMOTION: printm(M_INFO, "Mouse slept over the screen - (%i, %i)\n", event.motion.x, event.motion.y); + if (locked) { + if (!((event.motion.x == mx) && (event.motion.y == my))) { + SDL_WrapMouse(mx, my); + } + } if (cursorvisible) hastoreturn = true; break; @@ -217,3 +222,12 @@ int mogltk::engine::mousebuttons() { double mogltk::engine::FPS() { return curfps; } + +void mogltk::engine::lockmouse() { + locked = 1; +} + +void mogltk::engine::unlockmouse() { + locked = 0; +} + |