diff mde/events.d @ 10:4c3575400769

DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading. Init threads now catch own exceptions. Doc: assigned some inputID devisions. Added support for remaining SDL events. Input axes' output is now stored with a short instead of a real. Input unittest written (for SDL event handling). Rewrote most of mde.mergetag.defaultdata using generic programming to generate read & write rules for all types. As a direct result, defaultdata can now write properly. DefaultData unittest written (also provides testing for mergetag read/write). Moved mde.text.parse/format to tango.scrapple.text.convert.parseTo/parseFrom with many changes. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Mon, 18 Feb 2008 11:54:56 +0000
parents f63f4f41a2dc
children 5f90774ea1ef
line wrap: on
line diff
--- a/mde/events.d	Wed Jan 30 11:33:56 2008 +0000
+++ b/mde/events.d	Mon Feb 18 11:54:56 2008 +0000
@@ -2,8 +2,10 @@
 module mde.events;
 
 import mde.scheduler;
+import global = mde.global;
 
 import mde.input.input;
+import mde.input.exception;
 
 import derelict.sdl.events;
 
@@ -14,8 +16,6 @@
     logger = Log.getLogger ("mde.events");
 }
 
-static bool run = true;
-
 void addEventsSchedule () {
     Scheduler.perFrame (&pollEvents);
 }
@@ -26,10 +26,15 @@
         switch (event.type) {
             case SDL_QUIT:
                 logger.info ("Quit requested");
-                run = false;
+                global.run = false;
                 break;
             default:
-                input (event);
+                try {
+                    global.input (event);
+                } catch (InputClassException e) {
+                    logger.warn ("Caught input exception; event will be ignored. Exception was:");
+                    logger.warn (e.msg);
+                }
         }
     }
 }