Mercurial > projects > mde
comparison mde/scheduler/init2.d @ 49:bca7e2342d77
Enabled getting the size of a text block (before or after rendering).
committer: Diggory Hardy <diggory.hardy@gmail.com>
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 31 May 2008 13:10:06 +0100 |
parents | a98ffb64f066 |
children |
comparison
equal
deleted
inserted
replaced
48:a98ffb64f066 | 49:bca7e2342d77 |
---|---|
23 * This should make it much easier to tell what actually happens during init and to order init such | 23 * This should make it much easier to tell what actually happens during init and to order init such |
24 * that dependencies are honoured. | 24 * that dependencies are honoured. |
25 * | 25 * |
26 * Currently some external modules depend on InitFunctions, while some are set up from here. Once | 26 * Currently some external modules depend on InitFunctions, while some are set up from here. Once |
27 * all are set up from here, the Init* modules can be rearranged. */ | 27 * all are set up from here, the Init* modules can be rearranged. */ |
28 /* Idea: go back to init being controlled from elsewhere. Add a function to wait for another init | |
29 * function to complete (threaded; might need to be done differently for non-threaded). */ | |
28 module mde.scheduler.init2; | 30 module mde.scheduler.init2; |
29 | 31 |
30 import mde.scheduler.initFunctions; | 32 import mde.scheduler.initFunctions; |
31 | 33 |
32 import tango.util.log.Log : Log, Logger; | 34 import tango.util.log.Log : Log, Logger; |
43 static this () { | 45 static this () { |
44 logger = Log.getLogger ("mde.scheduler.Init2"); | 46 logger = Log.getLogger ("mde.scheduler.Init2"); |
45 | 47 |
46 init.addFunc (&initInput, "initInput"); | 48 init.addFunc (&initInput, "initInput"); |
47 init.addFunc (&guiLoad, "guiLoad"); | 49 init.addFunc (&guiLoad, "guiLoad"); |
48 init.addFunc (&initFreeType, "initFreeType"); | |
49 } | 50 } |
50 | 51 |
51 void guiLoad () { // init func | 52 void guiLoad () { // init func |
52 try { | 53 try { |
54 font.FontStyle.initialize; | |
53 gui.load (GUI); | 55 gui.load (GUI); |
54 cleanup.addFunc (&guiSave, "guiSave"); | 56 cleanup.addFunc (&guiSave, "guiSave"); |
55 } catch (Exception e) { | 57 } catch (Exception e) { |
56 logger.fatal ("guiLoad failed: " ~ e.msg); | 58 logger.fatal ("guiLoad failed: " ~ e.msg); |
57 setInitFailure; | 59 setInitFailure; |
82 logger.fatal ("initInput failed: " ~ e.msg); | 84 logger.fatal ("initInput failed: " ~ e.msg); |
83 setInitFailure; | 85 setInitFailure; |
84 } | 86 } |
85 } | 87 } |
86 | 88 |
87 void initFreeType () { // init func | |
88 try { | |
89 font.FontStyle.initialize; | |
90 } catch (Exception e) { | |
91 logger.fatal ("initFreeType failed: " ~ e.msg); | |
92 setInitFailure; | |
93 } | |
94 } | |
95 | |
96 /+ Potential wrapper function: | 89 /+ Potential wrapper function: |
97 // Template to call function, catching exceptions: | 90 // Template to call function, catching exceptions: |
98 void wrap(alias Func) () { | 91 void wrap(alias Func) () { |
99 try { | 92 try { |
100 Func(); | 93 Func(); |