diff mde/events.d @ 132:264028f4115a

Cleaned up mde.imde and a couple of widget functions. New mde.menus module to add default menus. The input singleton is now created in mde.input.Input instead of mde.imde.
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 23 Jan 2009 14:59:05 +0000
parents 9824bee909fd
children a86f8445ccc8
line wrap: on
line diff
--- a/mde/events.d	Wed Jan 21 13:01:40 2009 +0000
+++ b/mde/events.d	Fri Jan 23 14:59:05 2009 +0000
@@ -28,8 +28,10 @@
 import tango.util.log.Log : Log, Logger;
 
 private Logger logger;
+private Input input;
 static this() {
     logger = Log.getLogger ("mde.events");
+    input = Input.singleton;
 }
 
 void pollEvents (TimeSpan) {
@@ -37,7 +39,7 @@
     while (SDL_PollEvent (&event)) {
         switch (event.type) {
             case SDL_QUIT:
-                logger.info ("Quit requested");
+                debug logger.trace ("Quit (from SDL_QUIT event)");
                 imde.run = false;
                 break;
             case SDL_VIDEORESIZE:
@@ -50,8 +52,8 @@
                 break;
             default:
                 try {
-                    if (!imde.input (event))
-                        logger.warn ("Unrecognised event with code {}", event.type);
+                    if (!input.send (event))
+                        logger.info ("Unrecognised event with code {}", event.type);
                 } catch (Exception e) {
                     logger.error ("Caught input exception; event will be ignored. Exception was:");
                     logger.error (e.msg);