Mercurial > projects > mde
diff mde/mde.d @ 83:2813ac68576f
Start of creating a separate gui demo module and leaving mde.d for testing.
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Sat, 30 Aug 2008 10:54:32 +0100 |
parents | 25cb7420dc91 |
children | e0f1ec7fe73a |
line wrap: on
line diff
--- a/mde/mde.d Thu Aug 07 11:25:27 2008 +0100 +++ b/mde/mde.d Sat Aug 30 10:54:32 2008 +0100 @@ -15,22 +15,17 @@ /** Modular D Engine * - * This module contains main(), which calls Init and runs the main loop. + * This module contains a minimal main() function. Practically, it is useful for running unittests + * and some other testing. It also serves as a basic example program. */ module mde.mde; -// Comment to show use, where only used minimally: - import mde.imde; // this module's interface for external modules -import mde.events; // pollEvents +import mde.setup.Init; // initialization import mde.lookup.Options; // pollInterval option - +import mde.scheduler.Scheduler; // mainSchedule +import mde.events; // pollEvents() import gl = mde.gl.draw; // gl.draw() -import mde.input.Input; // new Input() - -import mde.setup.Init; -import mde.scheduler.Scheduler; // Scheduler.run() -import mde.setup.exception; // InitException import tango.core.Thread : Thread; // Thread.sleep() import tango.time.Clock; // Clock.now() @@ -38,24 +33,18 @@ int main(char[][] args) { - //BEGIN Initialisation - Logger logger = Log.getLogger ("mde.mde"); + // If compiled with unittests, notify that they completed and exit: debug (mdeUnitTest) { + Logger logger = Log.getLogger ("mde.mde"); logger.info ("Compiled unittests have completed; terminating."); return 0; } - scope Init init; - try { - init = new Init(args); // initialisation - } catch (InitException e) { - logger.fatal ("Initialisation failed: " ~ e.msg); - return 1; - } + scope Init init = new Init(args); // initialize mde + // Make sure pollInterval has a sane value. FIXME: get Options class to enforce range if (miscOpts.pollInterval !<= 1.0 || miscOpts.pollInterval !>= 0.0) miscOpts.set!(double) ("pollInterval", 0.01); - //END Initialisation //BEGIN Main loop setup /* Note: the main loop is currently controlled by the scheduler. This is not really ideal,