diff --git a/isometric-park-fna/FNAGame.cs b/isometric-park-fna/FNAGame.cs --- a/isometric-park-fna/FNAGame.cs +++ b/isometric-park-fna/FNAGame.cs @@ -62,6 +62,8 @@ TimeSpan gridDrawTime = TimeSpan.Zero; TimeSpan treeDrawTime = TimeSpan.Zero; TimeSpan rendererDrawTime = TimeSpan.Zero; + TimeSpan miscUIDrawTime = TimeSpan.Zero; + TimeSpan debugDrawTime = TimeSpan.Zero; TimeSpan updateTime = TimeSpan.Zero; TimeSpan worldUpdateTime = TimeSpan.Zero; TimeSpan simulationUpdateTime = TimeSpan.Zero; @@ -679,6 +681,7 @@ string fps = string.Format("fps: {0}", frameRate); bool has_tree = false; + Stopwatch stopWatch2 = new Stopwatch(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); @@ -697,7 +700,6 @@ #region draw_tiles - Stopwatch stopWatch2 = new Stopwatch(); stopWatch2.Start(); //reset this.tilesDrawn = 0; @@ -862,6 +864,8 @@ this.rendererDrawTime = stopWatch2.Elapsed; #region draw_header + stopWatch2 = new Stopwatch(); + stopWatch2.Start(); batch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, @@ -921,8 +925,17 @@ batch.DrawString(monoFont, status_left, new Vector2(1, top), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); batch.DrawString(monoFont, header_left, new Vector2(1, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); batch.DrawString(monoFont, header_middle, new Vector2(middle_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); + #endregion draw_header + + batch.End(); + + #region window + Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left); + stopWatch2.Stop(); + this.miscUIDrawTime = stopWatch2.Elapsed; + #region budget if (this.showBudget) @@ -932,11 +945,6 @@ #endregion budget - batch.End(); - - #region window - Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left); - if (quit) { System.Environment.Exit(0); } @@ -983,6 +991,8 @@ #region debug_window + stopWatch2 = new Stopwatch(); + stopWatch2.Start(); //Calcs for debug window: past_draw.Enqueue(this.drawTime); if ((this.frameCounter % 15) == 0) @@ -1021,6 +1031,8 @@ gridDrawTime = this.gridDrawTime, tileDrawTime = this.tileDrawTime, rendererDrawTime = this.rendererDrawTime, + miscUIDrawTime = this.miscUIDrawTime, + debugDrawTime = this.debugDrawTime, updateTime = this.updateTime, worldUpdateTime = this.worldUpdateTime, simulationUpdateTime = this.simulationUpdateTime, @@ -1082,6 +1094,9 @@ _imGuiRenderer.AfterLayout(); + stopWatch2.Stop(); + this.debugDrawTime = stopWatch2.Elapsed; + #endregion debug_window stopWatch.Stop(); diff --git a/isometric-park-fna/UI/DebugWindow.cs b/isometric-park-fna/UI/DebugWindow.cs --- a/isometric-park-fna/UI/DebugWindow.cs +++ b/isometric-park-fna/UI/DebugWindow.cs @@ -20,6 +20,8 @@ public TimeSpan gridDrawTime; public TimeSpan tileDrawTime; public TimeSpan rendererDrawTime; + public TimeSpan miscUIDrawTime; + public TimeSpan debugDrawTime; public Vector2 cameraPosition; public int treeCount; public Vector2 mouseGrid; @@ -227,11 +229,13 @@ ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps)); ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString())); - ImGui.Text(string.Format("\tTree: {0,7:F3}; Grid: {1,7:F3}; Tile: {2,7:F3}\n\t Renderer: {3,7:F3}", + ImGui.Text(string.Format("\tTree: {0,7:F3}; Grid: {1,7:F3}; Tile: {2,7:F3}\n\tRenderer: {3,7:F3}; Misc UI: {4,7:F3}; Debug: {5,7:F3}", debugInfo.treeDrawTime.TotalMilliseconds.ToString(), debugInfo.gridDrawTime.TotalMilliseconds.ToString(), debugInfo.tileDrawTime.TotalMilliseconds.ToString(), - debugInfo.rendererDrawTime.TotalMilliseconds.ToString())); + debugInfo.rendererDrawTime.TotalMilliseconds.ToString(), + debugInfo.miscUIDrawTime.TotalMilliseconds.ToString(), + debugInfo.debugDrawTime.TotalMilliseconds.ToString())); ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString())); ImGui.Text(string.Format("\tWorld: {0:F3}; Simulation: {1:F3}", debugInfo.worldUpdateTime.TotalMilliseconds.ToString(),