public void ShutDown() { // Release the mini-map object. MiniMap?.ShutDown(); MiniMap = null; // Release the render count strings. foreach (DText aSent in RenderCountStrings) { aSent?.Shutdown(); } RenderCountStrings = null; // Release the position text strings. foreach (DText sent in VideoStrings) { sent?.Shutdown(); } VideoStrings = null; // Release the position text strings. foreach (DText sentence in PositionStrings) { sentence?.Shutdown(); } PositionStrings = null; PreviousPositions = null; // Release the fps text string. FpsString?.Shutdown(); FpsString = null; // Release the font object. Font1?.Shutdown(); Font1 = null; }
// Methods public bool Initialize(DDX11 D3Ddevice, DSystemConfiguration configuration) { // Create the first font object. Font1 = new DFont(); // Initialize the first font object. if (!Font1.Initialize(D3Ddevice.Device, "font01.txt", "font01.bmp", 32.0f, 3)) { return(false); } // Create the text object for the fps string. FpsString = new DText(); // Initialize the fps text string. if (!FpsString.Initialize(D3Ddevice.Device, Font1, configuration, 16, "FPS: 0", 10, 50, 0.0f, 1.0f, 0.0f, false, D3Ddevice.DeviceContext)) { return(false); } // Initial the previous frame fps. PreviousFPS = -1; // Create the text objects for the position strings. PositionStrings = new DText[6]; for (int i = 0; i < PositionStrings.Length; i++) { PositionStrings[i] = new DText(); } // Initialize the position text strings. if (!PositionStrings[0].Initialize(D3Ddevice.Device, Font1, configuration, 16, "X: 0", 10, 90, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } if (!PositionStrings[1].Initialize(D3Ddevice.Device, Font1, configuration, 16, "Y: 0", 10, 110, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } if (!PositionStrings[2].Initialize(D3Ddevice.Device, Font1, configuration, 16, "Z: 0", 10, 130, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } if (!PositionStrings[3].Initialize(D3Ddevice.Device, Font1, configuration, 16, "rX: 0", 10, 170, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } if (!PositionStrings[4].Initialize(D3Ddevice.Device, Font1, configuration, 16, "rY: 0", 10, 190, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } if (!PositionStrings[5].Initialize(D3Ddevice.Device, Font1, configuration, 16, "rZ: 0", 10, 210, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } // Initialize the previous frame position. PreviousPositions = new int[6]; VideoStrings = new DText[2]; for (int i = 0; i < VideoStrings.Length; i++) { VideoStrings[i] = new DText(); } // Initialize the position text strings. if (!VideoStrings[0].Initialize(D3Ddevice.Device, Font1, configuration, 256, D3Ddevice.VideoCardDescription, 10, 10, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } if (!VideoStrings[1].Initialize(D3Ddevice.Device, Font1, configuration, 64, D3Ddevice.VideoCardMemory.ToString(), 10, 30, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } // Create the text objects for the render count strings. RenderCountStrings = new DText[3]; for (int i = 0; i < RenderCountStrings.Length; i++) { RenderCountStrings[i] = new DText(); } // Initialize the render count strings. if (!RenderCountStrings[0].Initialize(D3Ddevice.Device, Font1, configuration, 32, "Polys Drawn: 0", 10, 250, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } if (!RenderCountStrings[1].Initialize(D3Ddevice.Device, Font1, configuration, 32, "Cells Drawn: 0", 10, 270, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } if (!RenderCountStrings[2].Initialize(D3Ddevice.Device, Font1, configuration, 32, "Cells Culled: 0", 10, 290, 1.0f, 1.0f, 1.0f, false, D3Ddevice.DeviceContext)) { return(false); } // Create the mini-map object. MiniMap = new DMiniMap(); // Initialize the mini-map object. if (!MiniMap.Initialize(D3Ddevice.Device, D3Ddevice.DeviceContext, configuration, 1025, 1025)) { return(false); } return(true); }