Mercurial > projects > mde
annotate mde/mde.d @ 27:0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Implemented GUI code to load windows from file with a basic widget and draw.
Fixed a bug in mde.resource.paths.mdeDirectory.makeMTReader when called with readOrder == PRIORITY.HIGH_ONLY.
committer: Diggory Hardy <diggory.hardy@gmail.com>
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Fri, 04 Apr 2008 17:07:38 +0100 |
parents | 611f7b9063c6 |
children | 467c74d4804d |
rev | line source |
---|---|
17
5f90774ea1ef
Applied the GNU GPL v2 to mde.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
16
diff
changeset
|
1 /* LICENSE BLOCK |
5f90774ea1ef
Applied the GNU GPL v2 to mde.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
16
diff
changeset
|
2 Part of mde: a Modular D game-oriented Engine |
5f90774ea1ef
Applied the GNU GPL v2 to mde.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
16
diff
changeset
|
3 Copyright © 2007-2008 Diggory Hardy |
5f90774ea1ef
Applied the GNU GPL v2 to mde.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
16
diff
changeset
|
4 |
26
611f7b9063c6
Changed the licensing and removed a few dead files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
25
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify it under the terms |
611f7b9063c6
Changed the licensing and removed a few dead files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
25
diff
changeset
|
6 of the GNU General Public License as published by the Free Software Foundation, either |
611f7b9063c6
Changed the licensing and removed a few dead files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
25
diff
changeset
|
7 version 2 of the License, or (at your option) any later version. |
17
5f90774ea1ef
Applied the GNU GPL v2 to mde.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
16
diff
changeset
|
8 |
5f90774ea1ef
Applied the GNU GPL v2 to mde.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
16
diff
changeset
|
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
5f90774ea1ef
Applied the GNU GPL v2 to mde.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
16
diff
changeset
|
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
5f90774ea1ef
Applied the GNU GPL v2 to mde.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
16
diff
changeset
|
11 See the GNU General Public License for more details. |
5f90774ea1ef
Applied the GNU GPL v2 to mde.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
16
diff
changeset
|
12 |
26
611f7b9063c6
Changed the licensing and removed a few dead files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
25
diff
changeset
|
13 You should have received a copy of the GNU General Public License |
611f7b9063c6
Changed the licensing and removed a few dead files.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
25
diff
changeset
|
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
17
5f90774ea1ef
Applied the GNU GPL v2 to mde.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
16
diff
changeset
|
15 |
0 | 16 /** Modular D Engine |
17 * | |
25
2c28ee04a4ed
Some minor and some futile efforts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
24
diff
changeset
|
18 * This module contains main(), which calls Init and runs the main loop. |
0 | 19 */ |
20 module mde.mde; | |
21 | |
25
2c28ee04a4ed
Some minor and some futile efforts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
24
diff
changeset
|
22 // Comment to show use, where only used minimally: |
0 | 23 |
25
2c28ee04a4ed
Some minor and some futile efforts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
24
diff
changeset
|
24 import global = mde.global; // global.run |
2c28ee04a4ed
Some minor and some futile efforts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
24
diff
changeset
|
25 import mde.SDL; // unused (but must be linked in) |
2c28ee04a4ed
Some minor and some futile efforts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
24
diff
changeset
|
26 import mde.events; // unused (but must be linked in) |
27
0aa621b3e070
Some GUI work, plus a small fix in the paths module.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
26
diff
changeset
|
27 import mde.gui.gui; // unused (but must be linked in) |
20
838577503598
Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
18
diff
changeset
|
28 |
838577503598
Reworked much of Init.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
18
diff
changeset
|
29 import mde.scheduler.Init; |
25
2c28ee04a4ed
Some minor and some futile efforts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
24
diff
changeset
|
30 import mde.scheduler.runTime; // Scheduler.run() |
2c28ee04a4ed
Some minor and some futile efforts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
24
diff
changeset
|
31 import mde.scheduler.exception; // InitException |
0 | 32 |
25
2c28ee04a4ed
Some minor and some futile efforts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
24
diff
changeset
|
33 import tango.core.Thread : Thread; // Thread.sleep() |
2c28ee04a4ed
Some minor and some futile efforts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
24
diff
changeset
|
34 import tango.time.Clock; // Clock.now() |
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
|
35 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
|
36 |
0 | 37 int main() |
38 { | |
11
b940f267419e
Options class created & changes to mergetag exception messages.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
10
diff
changeset
|
39 //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
|
40 Logger logger = Log.getLogger ("mde.mde"); |
18
56a42ec95024
Changes to Init and logging.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
17
diff
changeset
|
41 logger.info ("Starting mde..."); |
21
a60cbb7359dd
Window settings now come from options, and may use OpenGL (enabled/disabled at compile time).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
20
diff
changeset
|
42 |
a60cbb7359dd
Window settings now come from options, and may use OpenGL (enabled/disabled at compile time).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
20
diff
changeset
|
43 scope Init init; |
0 | 44 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
|
45 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
|
46 } catch (InitException e) { |
25
2c28ee04a4ed
Some minor and some futile efforts.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
24
diff
changeset
|
47 logger.fatal ("Initialisation failed: " ~ e.msg); |
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
|
48 return 1; |
0 | 49 } |
11
b940f267419e
Options class created & changes to mergetag exception messages.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
10
diff
changeset
|
50 //END Initialisation |
b940f267419e
Options class created & changes to mergetag exception messages.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
10
diff
changeset
|
51 |
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
|
52 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
|
53 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
|
54 |
9
1885a9080f2a
Joystick button input now works with config.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
8
diff
changeset
|
55 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
|
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 |
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
|
58 return 0; // cleanup handled by init's DTOR |
0 | 59 } |