Description:
Add culling toggle and more logging.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r211:f687e82000f0 -

@@ -22,6 +22,10
22 22
23 23 You can build and run the project using VSCode actions.
24 24
25 Two debug commands:
26 * `\` enables the debug window
27 * `]` turns on culling (now debug-only)
28
25 29 ## Acknowledgements ##
26 30
27 31 Art: [Isometric 64x64 Outside Tileset by Yar](https://opengameart.org/content/isometric-64x64-outside-tileset), various images from the Library of Congress and USDA Forest Service
@@ -50,6 +50,9
50 50 case Element.Trees:
51 51 game.showTrees = !game.showTrees;
52 52 break;
53 case Element.Culling:
54 FNAGame.enableCulling = !FNAGame.enableCulling;
55 break;
53 56 }
54 57 }
55 58
@@ -159,6 +159,11
159 159 SendMessage(new ToggleVisibilityMessage{Element = Element.Trees});
160 160
161 161 }
162 if (keyboardCur.IsKeyDown(Keys.OemCloseBrackets) && keyboardPrev.IsKeyUp(Keys.OemCloseBrackets))
163 {
164 SendMessage(new ToggleVisibilityMessage{Element = Element.Culling});
165
166 }
162 167 #endif
163 168
164 169 if (keyboardCur.IsKeyDown(Keys.Q) && keyboardPrev.IsKeyUp(Keys.Q))
@@ -48,6 +48,7
48 48
49 49 Queue<float> past_fps = new Queue<float>(100);
50 50 int tilesDrawn = 0;
51 private int treesDrawn = 0;
51 52
52 53 private const int width = 1280;
53 54 private const int height = 640;
@@ -74,7 +75,7
74 75 int messageIndex;
75 76
76 77 //buggy
77 private static bool enableCulling = false;
78 public static bool enableCulling = false;
78 79
79 80 private Node<DialogOption> currentNode;
80 81 private Queue<Node<DialogOption>> remainingDialog;
@@ -707,11 +708,11
707 708 Quad.FillSquare2(batch, 8, 5, Color.Teal, .5f, 0.79f);
708 709 Quad.FillSquare2(batch, 8, 6, Color.Teal, .25f, 0.79f);
709 710 Quad.FillSquare2(batch, 8, 7, Color.Teal, .125f, 0.79f);
710 #endif
711 #endif
711 712
712 713
713 714
714 #endregion draw_cursor
715 #endregion draw_cursor
715 716 /*
716 717
717 718 for (int i = 0; i< 80; i++)
@@ -733,7 +734,9
733 734 }
734 735 }//*/
735 736
736 #region draw_trees
737 #region draw_trees
738
739 this.treesDrawn = 0;
737 740 if (this.showTrees) {
738 741 for (int i = 0; i < this.simulation.map.MapHeight; i++)
739 742 {
@@ -751,11 +754,12
751 754 // {
752 755 // drawTileAt(i, j, 142, 2);
753 756 // }
757 this.treesDrawn++;
754 758 }
755 759 else if (this.simulation.map.cells[i][j].status == CellStatus.DeadTree) {
756 760 drawTileAt(i, j, 141, 2);
757 761 // System.Console.WriteLine(String.Format("Drew Dead Tree at {0},{1}", i, j));
758
762 this.treesDrawn++;
759 763 }
760 764 }
761 765 }
@@ -853,7 +857,8
853 857 treeCount = this.simulation.map.tree_count,
854 858 mouseGrid = this.mouseGrid,
855 859 hasTree = has_tree,
856 tilesDrawn = this.tilesDrawn
860 tilesDrawn = this.tilesDrawn,
861 treesDrawn = this.treesDrawn
857 862 };
858 863
859 864 //Finally, draw the debug window
@@ -865,6 +870,8
865 870 var state = Mouse.GetState();
866 871 Vector2 delta = this.camera.position - this.original_point;
867 872
873 additionalInfo.Add("culling", FNAGame.enableCulling.ToString());
874
868 875 additionalInfo.Add("cameraMiddle", cameraMiddle.ToString());
869 876 additionalInfo.Add("mouse ", String.Format("{0}, {1}", state.X, state.Y));
870 877 additionalInfo.Add("mouse delta", delta.ToString());
@@ -5,8 +5,10
5 5
6 6 public enum Element {
7 7 Grid,
8 Trees
9 }
8 Trees,
9
10 Culling //Debug only
11 }
10 12
11 13 public struct ToggleVisibilityMessage : IMessage//, IHasEntity
12 14 {
@@ -58,7 +58,7
58 58
59 59 public const int MAX_TREES_TO_PLANT = 25;
60 60 public const int MAX_TREES_TO_CLEAR = 25;
61 private const int SUBSIDY_AMOUNT = 2000;
61 private const int SUBSIDY_AMOUNT = 3000;
62 62
63 63 public int Tick
64 64 {
@@ -22,6 +22,7
22 22 public Boolean hasTree;
23 23 public int tilesDrawn;
24 24 public TimeSpan updateTime;
25 public int treesDrawn;
25 26 }
26 27
27 28 public class DebugWindow
@@ -134,6 +135,7
134 135 ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString()));
135 136 ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString()));
136 137 ImGui.Text(string.Format("Tiles Drawn: {0:F}", debugInfo.tilesDrawn));
138 ImGui.Text(string.Format("Trees Drawn: {0:F}", debugInfo.treesDrawn));
137 139
138 140
139 141 ImGui.Text(string.Format("\nCamera Position: {0}", debugInfo.cameraPosition.ToString()));
You need to be logged in to leave comments. Login now