1 /** 2 * Retrograde Engine 3 * 4 * Authors: 5 * Mike Bierlee, m.bierlee@lostmoment.com 6 * Copyright: 2014-2021 Mike Bierlee 7 * License: 8 * This software is licensed under the terms of the MIT license. 9 * The full terms of the license can be found in the LICENSE.txt file. 10 */ 11 12 module retrograde.application; 13 14 import poodinis; 15 16 import retrograde.logging; 17 import retrograde.messaging; 18 import retrograde.engine; 19 import retrograde.input; 20 import retrograde.entity; 21 22 import std.experimental.logger; 23 24 enum WindowPosition { 25 centered, 26 custom 27 } 28 29 struct WindowCreationContext { 30 uint x = 0; 31 uint y = 0; 32 uint width = 640; 33 uint height = 480; 34 WindowPosition xWindowPosition = WindowPosition.centered; 35 WindowPosition yWindowPosition = WindowPosition.centered; 36 } 37 38 class RetrogradeDefaultApplicationContext : ApplicationContext { 39 40 public override void registerDependencies(shared(DependencyContainer) container) { 41 container.register!(CommandChannel, CoreEngineCommandChannel); 42 container.register!(CommandChannel, MappedInputCommandChannel); 43 44 container.register!(EventChannel, RawInputEventChannel); 45 46 container.register!InputHandler; 47 container.register!EntityManager; 48 } 49 50 @Component 51 public Logger logger() { 52 auto logger = new MultiLogger(); 53 54 auto stdoutLogger = new StdoutLogger(); 55 if (stdoutLogger.stdoutIsAvailable()) { 56 logger.insertLogger("stdoutLogger", stdoutLogger); 57 } 58 59 sharedLog = logger; 60 return logger; 61 } 62 63 }