summaryrefslogtreecommitdiff
path: root/lib/engine.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/engine.cc')
-rw-r--r--lib/engine.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/engine.cc b/lib/engine.cc
index 84014c7..d065346 100644
--- a/lib/engine.cc
+++ b/lib/engine.cc
@@ -13,6 +13,8 @@ int mogltk::engine::setup() throw(GeneralException) {
throw GeneralException(_("Unable to start SDL base system"));
}
atexit(SDL_Quit);
+
+ SDL_ShowCursor(0);
inited = 1;
@@ -87,3 +89,39 @@ SDL_RWops * mogltk::engine::RWFromHandle(Handle * h) throw (GeneralException) {
}
return r;
}
+
+void mogltk::engine::pollevents() {
+ SDL_Event event;
+
+ while(true) {
+ SDL_WaitEvent(&event);
+ switch(event.type) {
+ case SDL_VIDEOEXPOSE:
+ printm(M_INFO, "Needs to redraw\n");
+ return;
+ case SDL_MOUSEMOTION:
+ printm(M_INFO, "Mouse has gone over the screen - (%i, %i)\n", event.motion.x, event.motion.y);
+ break;
+ case SDL_QUIT:
+ printm(M_INFO, "Quit requested\n");
+ exit(0);
+ break;
+ case SDL_ACTIVEEVENT:
+ switch (event.active.state) {
+ case SDL_APPMOUSEFOCUS:
+ printm(M_INFO, String("Application ") + (event.active.gain ? "gained" : "loosed") + " mouse focus\n");
+ break;
+ case SDL_APPINPUTFOCUS:
+ printm(M_INFO, String("Application ") + (event.active.gain ? "gained" : "loosed") + " input focus\n");
+ break;
+ case SDL_APPACTIVE:
+ printm(M_INFO, String("Application was ") + (event.active.gain ? "restored" : "iconified"));
+ break;
+ }
+ break;
+ default:
+ printm(M_INFO, "Unknow event: %i\n", event.type);
+ break;
+ }
+ }
+}