| 1 |
/* LICENSE BLOCK |
|---|
| 2 |
Part of mde: a Modular D game-oriented Engine |
|---|
| 3 |
Copyright © 2007-2008 Diggory Hardy |
|---|
| 4 |
|
|---|
| 5 |
This program is free software: you can redistribute it and/or modify it under the terms |
|---|
| 6 |
of the GNU General Public License as published by the Free Software Foundation, either |
|---|
| 7 |
version 2 of the License, or (at your option) any later version. |
|---|
| 8 |
|
|---|
| 9 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|---|
| 10 |
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|---|
| 11 |
See the GNU General Public License for more details. |
|---|
| 12 |
|
|---|
| 13 |
You should have received a copy of the GNU General Public License |
|---|
| 14 |
along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
|---|
| 15 |
|
|---|
| 16 |
/** This module is for interfacing with the mde.mde module (or other module containing main()) and |
|---|
| 17 |
* some global items. */ |
|---|
| 18 |
module mde.imde; |
|---|
| 19 |
|
|---|
| 20 |
import mde.input.Input; |
|---|
| 21 |
import mde.scheduler.Scheduler; |
|---|
| 22 |
import mde.content.miscContent; |
|---|
| 23 |
|
|---|
| 24 |
static this () { |
|---|
| 25 |
// Make these available to all importing modules' static CTORs, as well as during init. |
|---|
| 26 |
input = new Input(); |
|---|
| 27 |
mainSchedule = new Scheduler; |
|---|
| 28 |
|
|---|
| 29 |
quit = (new EventContent("quit")).addCallback ((Content){ |
|---|
| 30 |
run = false; |
|---|
| 31 |
}); |
|---|
| 32 |
menu = new ContentList ("menu",[quit, |
|---|
| 33 |
new EventContent("a"), |
|---|
| 34 |
new ContentList("subMenu",[ |
|---|
| 35 |
new EventContent("b"), |
|---|
| 36 |
new EventContent("c")]) |
|---|
| 37 |
]); |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
ContentList menu; /// Root menu for imde |
|---|
| 41 |
EventContent quit; /// A content triggering mde to halt |
|---|
| 42 |
|
|---|
| 43 |
Scheduler mainSchedule; /// The schedule used by the main loop. |
|---|
| 44 |
|
|---|
| 45 |
/** Some enums used by per request scheduled functions. */ |
|---|
| 46 |
enum SCHEDULE : Scheduler.ID { |
|---|
| 47 |
DRAW |
|---|
| 48 |
}; |
|---|
| 49 |
|
|---|
| 50 |
bool run = true; // main loop continues if this is true |
|---|
| 51 |
|
|---|
| 52 |
Input input; // Input instance. When multiple users are allowed instances will be per-user. |
|---|