Description:
Add timers.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -49,7 +49,7 | |||
|
49 | 49 | private SpriteFont monoFont; |
|
50 | 50 | private SpriteFont largeMonoFont; |
|
51 | 51 | |
|
52 | private Camera camera = new Camera(new float[] { 0.25f, 0.5f, 1.0f, 2.0f, 4.0f }); | |
|
52 | private Camera camera = new Camera(new float[] {0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f }); | |
|
53 | 53 | |
|
54 | 54 | Random random_generator = new Random(); |
|
55 | 55 | |
@@ -57,6 +57,9 | |||
|
57 | 57 | int frameCounter = 0; |
|
58 | 58 | TimeSpan elapsedTime = TimeSpan.Zero; |
|
59 | 59 | TimeSpan drawTime = TimeSpan.Zero; |
|
60 | TimeSpan tileDrawTime = TimeSpan.Zero; | |
|
61 | TimeSpan gridDrawTime = TimeSpan.Zero; | |
|
62 | TimeSpan treeDrawTime = TimeSpan.Zero; | |
|
60 | 63 | TimeSpan updateTime = TimeSpan.Zero; |
|
61 | 64 | |
|
62 | 65 | Queue<float> past_fps = new Queue<float>(100); |
@@ -66,8 +69,8 | |||
|
66 | 69 | private static int height = 640; |
|
67 | 70 | |
|
68 | 71 | //new tile stuff |
|
69 |
int squaresAcross = |
|
|
70 |
int squaresDown = |
|
|
72 | int squaresAcross = 200; | |
|
73 | int squaresDown = 200; | |
|
71 | 74 | |
|
72 | 75 | Simulation simulation; |
|
73 | 76 | |
@@ -550,6 +553,8 | |||
|
550 | 553 | |
|
551 | 554 | |
|
552 | 555 | #region draw_tiles |
|
556 | Stopwatch stopWatch2 = new Stopwatch(); | |
|
557 | stopWatch2.Start(); | |
|
553 | 558 | //reset |
|
554 | 559 | this.tilesDrawn = 0; |
|
555 | 560 | |
@@ -579,9 +584,13 | |||
|
579 | 584 | } |
|
580 | 585 | } |
|
581 | 586 | } |
|
587 | stopWatch2.Stop(); | |
|
588 | this.tileDrawTime = stopWatch2.Elapsed; | |
|
582 | 589 | #endregion draw_tiles |
|
583 | 590 | |
|
584 | 591 | #region draw_gridlines |
|
592 | stopWatch2 = new Stopwatch(); | |
|
593 | stopWatch2.Start(); | |
|
585 | 594 | |
|
586 | 595 | if (this.showGrid) |
|
587 | 596 | { |
@@ -615,6 +624,8 | |||
|
615 | 624 | |
|
616 | 625 | } |
|
617 | 626 | } |
|
627 | stopWatch2.Stop(); | |
|
628 | this.gridDrawTime = stopWatch2.Elapsed; | |
|
618 | 629 | #endregion draw_gridlines |
|
619 | 630 | |
|
620 | 631 | |
@@ -696,6 +707,8 | |||
|
696 | 707 | |
|
697 | 708 | #endregion draw_cursor |
|
698 | 709 | |
|
710 | stopWatch2 = new Stopwatch(); | |
|
711 | stopWatch2.Start(); | |
|
699 | 712 | #region draw_trees |
|
700 | 713 | if (this.showTrees) { |
|
701 | 714 | for (int i = 0; i < this.simulation.map.MapHeight; i++) |
@@ -721,6 +734,8 | |||
|
721 | 734 | } |
|
722 | 735 | } |
|
723 | 736 | } |
|
737 | stopWatch2.Stop(); | |
|
738 | this.treeDrawTime = stopWatch2.Elapsed; | |
|
724 | 739 | #endregion draw_trees |
|
725 | 740 | |
|
726 | 741 | #if DEBUG |
@@ -870,6 +885,9 | |||
|
870 | 885 | pastFps = past_fps.ToArray(), |
|
871 | 886 | cameraPosition = camera.position, |
|
872 | 887 | drawTime = this.drawTime, |
|
888 | treeDrawTime = this.treeDrawTime, | |
|
889 | gridDrawTime = this.gridDrawTime, | |
|
890 | tileDrawTime = this.tileDrawTime, | |
|
873 | 891 | updateTime = this.updateTime, |
|
874 | 892 | treeCount = this.simulation.map.tree_count, |
|
875 | 893 | mouseGrid = this.mouseGrid, |
@@ -17,6 +17,9 | |||
|
17 | 17 | public float fps; |
|
18 | 18 | public float[] pastFps; |
|
19 | 19 | public TimeSpan drawTime; |
|
20 | public TimeSpan treeDrawTime; | |
|
21 | public TimeSpan gridDrawTime; | |
|
22 | public TimeSpan tileDrawTime; | |
|
20 | 23 | public Vector2 cameraPosition; |
|
21 | 24 | public int treeCount; |
|
22 | 25 | public Vector2 mouseGrid; |
@@ -224,6 +227,10 | |||
|
224 | 227 | |
|
225 | 228 | ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps)); |
|
226 | 229 | ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString())); |
|
230 | ImGui.Text(string.Format("\tTree: {0:F3}; Grid: {1:F3}; Tile: {2:F3}", | |
|
231 | debugInfo.treeDrawTime.TotalMilliseconds.ToString(), | |
|
232 | debugInfo.gridDrawTime.TotalMilliseconds.ToString(), | |
|
233 | debugInfo.tileDrawTime.TotalMilliseconds.ToString())); | |
|
227 | 234 | ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString())); |
|
228 | 235 | ImGui.Text(string.Format("Tiles Drawn: {0:F}", debugInfo.tilesDrawn)); |
|
229 | 236 |
You need to be logged in to leave comments.
Login now