annotate mde/mde.d @ 15:4608be19ebe2

Use OS paths (linux only for now), merging multiple paths. Init changes regarding options. Reorganised policies.txt a little. Implemented mde.resource.paths to read config from appropriate paths (currently linux only). Changed Init to load options before all other delegates are run and set logging level from options. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 14 Mar 2008 11:39:45 +0000
parents bff0d802cb7d
children 9cb7b9310168
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
1 /** Modular D Engine
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
2 *
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
3 * This module contains main().
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
4 */
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
5 module mde.mde;
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
6
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
7 // Package imports
15
4608be19ebe2 Use OS paths (linux only for now), merging multiple paths. Init changes regarding options.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 12
diff changeset
8 import mde.Init;
10
4c3575400769 DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 9
diff changeset
9 import global = mde.global;
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
10 import mde.events;
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
11 import mde.scheduler;
15
4608be19ebe2 Use OS paths (linux only for now), merging multiple paths. Init changes regarding options.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 12
diff changeset
12 import mde.i18n.I18nTranslation; // greeting message
10
4c3575400769 DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 9
diff changeset
13 import mde.exception;
0
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
14
2
78eb491bd642 mergetag: partially redesigned dataset and text reader classes. Changed text format.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 0
diff changeset
15 import mde.input.input;
0
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
16
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
17 // External library imports
10
4c3575400769 DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 9
diff changeset
18 import tango.core.Thread : Thread; // for sleep
4c3575400769 DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 9
diff changeset
19 //import tango.io.Stdout;
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
20 import tango.time.Clock;
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
21 import tango.util.log.Log : Log, Logger;
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
22
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
23 import derelict.sdl.sdl;
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
24
0
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
25 int main()
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
26 {
11
b940f267419e Options class created & changes to mergetag exception messages.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 10
diff changeset
27 //BEGIN Initialisation
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
28 Logger logger = Log.getLogger ("mde.mde");
0
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
29
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
30 scope Init init;
0
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
31 try {
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
32 init = new Init(); // initialisation
15
4608be19ebe2 Use OS paths (linux only for now), merging multiple paths. Init changes regarding options.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 12
diff changeset
33 } catch (InitException e) {
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
34 logger.fatal ("Initialisation failed; error was:");
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
35 logger.fatal (e.msg);
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
36 return 1;
0
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
37 }
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
38
10
4c3575400769 DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 9
diff changeset
39 global.input.addButtonCallback (cast(Input.inputID) 0x0u, delegate void(Input.inputID i, bool b) {
4c3575400769 DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 9
diff changeset
40 if (b) {
4c3575400769 DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 9
diff changeset
41 logger.info ("Quiting...");
4c3575400769 DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 9
diff changeset
42 global.run = false;
4c3575400769 DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 9
diff changeset
43 }
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
44 } );
11
b940f267419e Options class created & changes to mergetag exception messages.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 10
diff changeset
45 //END Initialisation
b940f267419e Options class created & changes to mergetag exception messages.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 10
diff changeset
46
12
bff0d802cb7d Implemented some internationalization support.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 11
diff changeset
47 /* Log a greeting message. Just a little test really, but it can stay until i18n finds a proper use. */
bff0d802cb7d Implemented some internationalization support.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 11
diff changeset
48 I18nTranslation transl = I18nTranslation.load ("mde");
bff0d802cb7d Implemented some internationalization support.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 11
diff changeset
49 logger.info (transl.getEntry ("greeting"));
9
1885a9080f2a Joystick button input now works with config.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 8
diff changeset
50
10
4c3575400769 DefaultData largely rewritten with unittest, SDL input event handling completed with unittest, changes to Init threading.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 9
diff changeset
51 while (global.run) {
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
52 Scheduler.run (Clock.now());
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
53
9
1885a9080f2a Joystick button input now works with config.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 8
diff changeset
54 Thread.sleep (0.050); // sleep this many seconds
4
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
55 }
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
56
9a990644948c Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more.
Diggory Hardy <diggory.hardy@gmail.com>
parents: 3
diff changeset
57 return 0; // cleanup handled by init's DTOR
0
d547009c104c Repository creation.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff changeset
58 }