protected override void Draw(GameTime gameTime) { if (m_debugFont == null) { return; } // MyRender.GetRenderProfiler().StartProfilingBlock("MyMinerGame::Draw"); // if (MyMinerGame.IsDeviceResetted) // return; /* * if (ResetSleep > 0) * { * ResetSleep--; * GraphicsDevice.Clear(Color.Black); * if (ResetSleep == 0) * { * MyMwcLog.WriteLine("Reset sleep - START"); * MyTextureManager.ReloadTextures(false); * MyGuiManager.UpdateAfterDeviceReset(); * MyMwcLog.WriteLine("Reset sleep - END"); * } * return; * } */ if (MyMwcFinalBuildConstants.EnableLoggingInDrawAndUpdateAndGuiLoops) { MyMwcLog.WriteLine("MyMinerGame.Draw() - START"); MyMwcLog.IncreaseIndent(); MyMwcLog.WriteLine("Draw - gameTime.ElapsedGameTime: " + gameTime.ElapsedGameTime); MyMwcLog.WriteLine("Draw - gameTime.TotalGameTime: " + gameTime.TotalGameTime); } UpdateTimes(gameTime); MyFpsManager.Update(); GraphicsDevice.Clear(ClearFlags.Target, new ColorBGRA(0.0f), 1, 0); if (GraphicsDevice.IsDisposed) { //MyMwcLog.WriteLine("MyMinerGame.Draw() - MyFakes.ALLOW_RENDER_HACK == false... skipping Draw"); //MyRender.GetRenderProfiler().EndProfilingBlock(); return; } /* * // This hack is for PerfHUD. It will allow us to see correct PerfHUD GUI (not corrupted by some error), so we will see colors on graph menu. * if (MyMwcFinalBuildConstants.ENABLE_PERFHUD == true) * { * GraphicsDevice.DepthStencilState = DepthStencilState.Default; * } */ if (MyMwcFinalBuildConstants.SimulateSlowDraw == true) { System.Threading.Thread.Sleep(60); } // MyRender.ResetStates(); MyGuiManager.Draw(); // This hack is for PerfHUD. It will allow us to see correct PerfHUD GUI (not corrupted by some error), so we will see colors on graph menu. /*if (MyMwcFinalBuildConstants.ENABLE_PERFHUD == true) * { * GraphicsDevice.DepthStencilState = DepthStencilState.None; * } */ DepthStencilState.None.Apply(); RasterizerState.CullNone.Apply(); BlendState.Opaque.Apply(); //m_debugFont.DrawText(null, MyFpsManager.GetFps().ToString() + " (" + MyFpsManager.FrameTimeAvg.ToString() + "ms) ", 0, 0, new ColorBGRA(1.0f, 1.0f, 1.0f, 1.0f)); if (MyMwcFinalBuildConstants.EnableLoggingInDrawAndUpdateAndGuiLoops == true) { MyMwcLog.DecreaseIndent(); MyMwcLog.WriteLine("MyMinerGame.Draw() - END"); } base.Draw(gameTime); if (OnGameDraw != null) { OnGameDraw(gameTime); } }