Mercurial > projects > mde
comparison mde/events.d @ 23:47478557428d
Implemented drawing a very basic gl box, and only drawing when necessary.
Improvements to window resizing, and gl draws a box as a test.
Scheduler has "on request" support to redraws only when requested by an event.
committer: Diggory Hardy <diggory.hardy@gmail.com>
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Thu, 27 Mar 2008 10:58:57 +0000 |
parents | 249eb6620685 |
children | 32eff0e01c05 |
comparison
equal
deleted
inserted
replaced
22:249eb6620685 | 23:47478557428d |
---|---|
32 private Logger logger; | 32 private Logger logger; |
33 static this() { | 33 static this() { |
34 logger = Log.getLogger ("mde.events"); | 34 logger = Log.getLogger ("mde.events"); |
35 | 35 |
36 init2.addFunc (&initInput); | 36 init2.addFunc (&initInput); |
37 | |
38 Scheduler.perFrame (&pollEvents); | |
37 } | 39 } |
38 | 40 |
39 void initInput () { // init2 func | 41 void initInput () { // init2 func |
40 logger.trace ("init2: initInput() started"); | 42 logger.trace ("init2: initInput() started"); |
41 | 43 |
42 try { | 44 try { |
43 global.input = new Input(); | 45 global.input = new Input(); |
44 global.input.loadConfig (); // (may also create instance) | 46 global.input.loadConfig (); // (may also create instance) |
45 | |
46 Scheduler.perFrame (&pollEvents); | |
47 } catch (Exception e) { | 47 } catch (Exception e) { |
48 setInitFailure (); // must clean up properly | 48 setInitFailure (); // must clean up properly |
49 } | 49 } |
50 | 50 |
51 logger.trace ("init2: initInput() finished"); | 51 logger.trace ("init2: initInput() finished"); |
59 logger.info ("Quit requested"); | 59 logger.info ("Quit requested"); |
60 global.run = false; | 60 global.run = false; |
61 break; | 61 break; |
62 case SDL_VIDEORESIZE: | 62 case SDL_VIDEORESIZE: |
63 mde.SDL.resizeWindow (event.resize.w, event.resize.h); | 63 mde.SDL.resizeWindow (event.resize.w, event.resize.h); |
64 Scheduler.requestUpdate(RF_KEYS.DRAW); | |
65 break; | |
66 case SDL_ACTIVEEVENT: | |
67 case SDL_VIDEOEXPOSE: | |
68 Scheduler.requestUpdate(RF_KEYS.DRAW); | |
64 break; | 69 break; |
65 default: | 70 default: |
66 try { | 71 try { |
67 global.input (event); | 72 global.input (event); |
68 } catch (InputClassException e) { | 73 } catch (InputClassException e) { |