Mercurial > projects > mde
annotate mde/imde.d @ 128:41582439a42b
Added support for dynamic EnumContent loading and saving, with translation loading.
WMScreen.init removed; code moved to this() since class is now created by main() instead of a static this().
Fix for SwitchWidget not passing events. Still some resizing bugs evident in SwitchWidget :-(
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Wed, 14 Jan 2009 20:24:14 +0000 |
parents | 3e648bc53bde |
children | 264028f4115a |
rev | line source |
---|---|
36
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
1 /* LICENSE BLOCK |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
2 Part of mde: a Modular D game-oriented Engine |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
3 Copyright © 2007-2008 Diggory Hardy |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
4 |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
5 This program is free software: you can redistribute it and/or modify it under the terms |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
6 of the GNU General Public License as published by the Free Software Foundation, either |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
7 version 2 of the License, or (at your option) any later version. |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
8 |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
10 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
11 See the GNU General Public License for more details. |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
12 |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
13 You should have received a copy of the GNU General Public License |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
14 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
15 |
95
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
16 /** This module is for interfacing with the mde.mde module (or other module containing main()) and |
2a364c7d82c9
Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
75
diff
changeset
|
17 * some global items. */ |
36
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
18 module mde.imde; |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
19 |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
20 import mde.input.Input; |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
21 import mde.scheduler.Scheduler; |
115
1b1e2297e2fc
Enums handled more generically now via either a popup list or flat list of BoolContentWidgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
113
diff
changeset
|
22 import mde.content.miscContent; |
36
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
23 |
75
25cb7420dc91
A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
36
diff
changeset
|
24 static this () { |
25cb7420dc91
A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
36
diff
changeset
|
25 // Make these available to all importing modules' static CTORs, as well as during init. |
25cb7420dc91
A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
36
diff
changeset
|
26 input = new Input(); |
25cb7420dc91
A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
36
diff
changeset
|
27 mainSchedule = new Scheduler; |
105
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
28 |
123
d3b2cefd46c9
minSizeChange() allows run-time changes to widgets' minimal size (except for shrinking in a GridLayoutWidget).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
117
diff
changeset
|
29 quit = new EventContent("quit"); |
d3b2cefd46c9
minSizeChange() allows run-time changes to widgets' minimal size (except for shrinking in a GridLayoutWidget).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
117
diff
changeset
|
30 quit.addCallback ((Content){ |
105
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
31 run = false; |
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
32 }); |
123
d3b2cefd46c9
minSizeChange() allows run-time changes to widgets' minimal size (except for shrinking in a GridLayoutWidget).
Diggory Hardy <diggory.hardy@gmail.com>
parents:
117
diff
changeset
|
33 menu = new ContentList ("menu",[cast(Content) quit, |
117
aba2dd815a1f
Some tweaks to popup events and widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
115
diff
changeset
|
34 new EventContent("a"), |
aba2dd815a1f
Some tweaks to popup events and widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
115
diff
changeset
|
35 new ContentList("subMenu",[ |
aba2dd815a1f
Some tweaks to popup events and widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
115
diff
changeset
|
36 new EventContent("b"), |
aba2dd815a1f
Some tweaks to popup events and widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
115
diff
changeset
|
37 new EventContent("c")]) |
aba2dd815a1f
Some tweaks to popup events and widgets.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
115
diff
changeset
|
38 ]); |
75
25cb7420dc91
A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
36
diff
changeset
|
39 } |
25cb7420dc91
A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
36
diff
changeset
|
40 |
113
9824bee909fd
Popup menu; works for simple menus except that clicking an item doesn't close it.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
105
diff
changeset
|
41 ContentList menu; /// Root menu for imde |
105
08651e8a8c51
Quit button, big changes to content system.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
95
diff
changeset
|
42 EventContent quit; /// A content triggering mde to halt |
75
25cb7420dc91
A massive overhaul/rewrite for the gui's data management and setup code. Currently much that was working is broken.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
36
diff
changeset
|
43 |
36
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
44 Scheduler mainSchedule; /// The schedule used by the main loop. |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
45 |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
46 /** Some enums used by per request scheduled functions. */ |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
47 enum SCHEDULE : Scheduler.ID { |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
48 DRAW |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
49 }; |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
50 |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
51 bool run = true; // main loop continues if this is true |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
52 |
57d000574d75
Enabled drawing on demand, and made the polling interval configurable.
Diggory Hardy <diggory.hardy@gmail.com>
parents:
diff
changeset
|
53 Input input; // Input instance. When multiple users are allowed instances will be per-user. |