1 module dash.core.main; 2 import dash.core.dgame, dash.editor.editor; 3 4 /** 5 * Initializes reflection things. 6 */ 7 static this() 8 { 9 ClassInfo gameType = typeid(DGame); 10 ClassInfo editorType = typeid(Editor); 11 12 foreach( mod; ModuleInfo ) 13 { 14 foreach( klass; mod.localClasses ) 15 { 16 // Find the appropriate game loop. 17 if( klass.base == typeid(DGame) ) 18 gameType = klass; 19 else if( klass.base == typeid(Editor) ) 20 editorType = klass; 21 } 22 } 23 24 DGame.instance = cast(DGame)gameType.create(); 25 DGame.instance.editor = cast(Editor)editorType.create(); 26 } 27 28 version( unittest ) { } 29 else 30 { 31 import dash.core.dgame; 32 import std.stdio; 33 34 /// Does exactly what you think it does. 35 void main() 36 { 37 if( !DGame.instance ) 38 { 39 writeln( "No game supplied." ); 40 return; 41 } 42 43 DGame.instance.run(); 44 } 45 }