summaryrefslogtreecommitdiff
path: root/lib/engine.cc
diff options
context:
space:
mode:
authorpixel <pixel>2003-01-21 01:50:58 +0000
committerpixel <pixel>2003-01-21 01:50:58 +0000
commitcbb8340d3b139596e94f2caa3ca51577d8fa3d0e (patch)
treeb31bd1948b461e6f4bbd87394bede1ec2285f464 /lib/engine.cc
parentf953fad0ce8c3358659fb63e99e0798bc20c392e (diff)
Fixed a bit the SDL code...
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;
+ }
+ }
+}