From 38a65f1d57c4dc65dcce9056725ce26e0474eabc Mon Sep 17 00:00:00 2001 From: pixel Date: Tue, 21 Jan 2003 03:00:13 +0000 Subject: Fixing more things... --- lib/engine.cc | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'lib/engine.cc') diff --git a/lib/engine.cc b/lib/engine.cc index d065346..fac660e 100644 --- a/lib/engine.cc +++ b/lib/engine.cc @@ -3,6 +3,7 @@ #define _(x) x int mogltk::engine::inited = 0; +bool mogltk::engine::appactive = false, mogltk::engine::cursorvisible = false; int mogltk::engine::setup() throw(GeneralException) { if (inited) { @@ -14,8 +15,6 @@ int mogltk::engine::setup() throw(GeneralException) { } atexit(SDL_Quit); - SDL_ShowCursor(0); - inited = 1; return 0; @@ -92,15 +91,22 @@ SDL_RWops * mogltk::engine::RWFromHandle(Handle * h) throw (GeneralException) { void mogltk::engine::pollevents() { SDL_Event event; + bool hastoreturn = appactive; while(true) { + if (hastoreturn) + if (!SDL_PollEvent(NULL)) + return; SDL_WaitEvent(&event); switch(event.type) { case SDL_VIDEOEXPOSE: printm(M_INFO, "Needs to redraw\n"); - return; + hastoreturn = true; + break; case SDL_MOUSEMOTION: printm(M_INFO, "Mouse has gone over the screen - (%i, %i)\n", event.motion.x, event.motion.y); + if (cursorvisible) + hastoreturn = true; break; case SDL_QUIT: printm(M_INFO, "Quit requested\n"); @@ -125,3 +131,19 @@ void mogltk::engine::pollevents() { } } } + +void mogltk::engine::setappactive(bool p) { + appactive = p; +} + +bool mogltk::engine::getappactive() { + return appactive; +} + +void mogltk::engine::setcursorvisible(bool p) { + cursorvisible = p; +} + +bool mogltk::engine::getcursorvisible() { + return cursorvisible; +} -- cgit v1.2.3