# HG changeset patch # User Alys Brooks # Date 2022-01-12 05:41:48 # Node ID d097c0d7d2e6e79f9b8cb8ad74986b38c778334a # Parent fb04f8102385f07a0c645c15180e563517928432 Add timers. 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 @@ -49,7 +49,7 @@ private SpriteFont monoFont; private SpriteFont largeMonoFont; - private Camera camera = new Camera(new float[] { 0.25f, 0.5f, 1.0f, 2.0f, 4.0f }); + private Camera camera = new Camera(new float[] {0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f }); Random random_generator = new Random(); @@ -57,6 +57,9 @@ int frameCounter = 0; TimeSpan elapsedTime = TimeSpan.Zero; TimeSpan drawTime = TimeSpan.Zero; + TimeSpan tileDrawTime = TimeSpan.Zero; + TimeSpan gridDrawTime = TimeSpan.Zero; + TimeSpan treeDrawTime = TimeSpan.Zero; TimeSpan updateTime = TimeSpan.Zero; Queue past_fps = new Queue(100); @@ -66,8 +69,8 @@ private static int height = 640; //new tile stuff - int squaresAcross = 50; - int squaresDown = 50; + int squaresAcross = 200; + int squaresDown = 200; Simulation simulation; @@ -550,6 +553,8 @@ #region draw_tiles + Stopwatch stopWatch2 = new Stopwatch(); + stopWatch2.Start(); //reset this.tilesDrawn = 0; @@ -579,9 +584,13 @@ } } } + stopWatch2.Stop(); + this.tileDrawTime = stopWatch2.Elapsed; #endregion draw_tiles #region draw_gridlines + stopWatch2 = new Stopwatch(); + stopWatch2.Start(); if (this.showGrid) { @@ -615,6 +624,8 @@ } } + stopWatch2.Stop(); + this.gridDrawTime = stopWatch2.Elapsed; #endregion draw_gridlines @@ -696,6 +707,8 @@ #endregion draw_cursor + stopWatch2 = new Stopwatch(); + stopWatch2.Start(); #region draw_trees if (this.showTrees) { for (int i = 0; i < this.simulation.map.MapHeight; i++) @@ -721,6 +734,8 @@ } } } + stopWatch2.Stop(); + this.treeDrawTime = stopWatch2.Elapsed; #endregion draw_trees #if DEBUG @@ -870,6 +885,9 @@ pastFps = past_fps.ToArray(), cameraPosition = camera.position, drawTime = this.drawTime, + treeDrawTime = this.treeDrawTime, + gridDrawTime = this.gridDrawTime, + tileDrawTime = this.tileDrawTime, updateTime = this.updateTime, treeCount = this.simulation.map.tree_count, mouseGrid = this.mouseGrid, 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 @@ -17,6 +17,9 @@ public float fps; public float[] pastFps; public TimeSpan drawTime; + public TimeSpan treeDrawTime; + public TimeSpan gridDrawTime; + public TimeSpan tileDrawTime; public Vector2 cameraPosition; public int treeCount; public Vector2 mouseGrid; @@ -224,6 +227,10 @@ 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:F3}; Grid: {1:F3}; Tile: {2:F3}", + debugInfo.treeDrawTime.TotalMilliseconds.ToString(), + debugInfo.gridDrawTime.TotalMilliseconds.ToString(), + debugInfo.tileDrawTime.TotalMilliseconds.ToString())); ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString())); ImGui.Text(string.Format("Tiles Drawn: {0:F}", debugInfo.tilesDrawn));