1 /** 2 * Container for the graphics adapter needed for the appropriate platform 3 */ 4 module dash.graphics.graphics; 5 import dash.graphics.adapters, dash.graphics.shaders; 6 7 /** 8 * Abstract class to store the appropriate Adapter 9 */ 10 final abstract class Graphics 11 { 12 public static: 13 /// The active Adapter 14 Adapter adapter; 15 /// Aliases adapter to Graphics 16 alias adapter this; 17 18 /** 19 * Initialize the controllers. 20 */ 21 final void initialize() 22 { 23 version( DashUseSDL2 ) 24 { 25 adapter = new Sdl; 26 } 27 else version( DashUseNativeAdapter ) 28 { 29 version( Windows ) 30 { 31 adapter = new Win32GL; 32 } 33 else version( linux ) 34 { 35 adapter = new Linux; 36 } 37 } 38 else 39 { 40 version( Windows ) 41 { 42 adapter = new Win32GL; 43 } 44 else version( linux ) 45 { 46 adapter = new Linux; 47 } 48 else 49 { 50 adapter = new Sdl; 51 } 52 } 53 54 adapter.initialize(); 55 adapter.initializeDeferredRendering(); 56 Shaders.initialize(); 57 } 58 59 /** 60 * Shutdown the adapter and shaders. 61 */ 62 final void shutdown() 63 { 64 Shaders.shutdown(); 65 adapter.shutdown(); 66 } 67 68 private: 69 this() { } 70 }