Description:
Add buttons.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r91:45de75872b2c -

@@ -388,6 +388,13
388 388 this.simulation.paused = false;
389 389 this.simulation.setRate(3);
390 390 }
391 #if DEBUG
392 if (keyboardCur.IsKeyDown(Keys.D5) && keyboardPrev.IsKeyUp(Keys.D5) )
393 {
394 this.simulation.paused = false;
395 this.simulation.setRate(4);
396 }
397 #endif
391 398 #endregion gamerate_keys
392 399
393 400 #if DEBUG
@@ -396,18 +403,6
396 403
397 404
398 405
399
400 //if (keyboardCur.IsKeyDown(Keys.P) && keyboardPrev.IsKeyUp(Keys.P))
401 // {
402 // this.player_state = !this.player_state;
403 // }
404
405 //if (player_state )
406 //{
407 // MediaPlayer.Play(music);
408 //}
409
410
411 406 MouseState mouseCur = Mouse.GetState();
412 407 this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice)));
413 408
@@ -869,7 +864,7
869 864 }
870 865
871 866 bool quit = false;
872 Menu.Render(debugWindow.monoFont, ref quit, ref this.simulation.paused, ref this.simulation.currentRate,
867 Menu.Render(debugWindow.monoFont, FNAGame.width, ref quit, ref this.simulation.paused, ref this.simulation.currentRate,
873 868 ref this.showBudget, ref this.showForest);
874 869
875 870 if (quit) {
@@ -7,7 +7,27
7 7
8 8 public static class Menu
9 9 {
10 public static void Render(ImFontPtr font, ref bool quit, ref bool paused, ref int rate, ref bool show_budget, ref bool show_forest)
10
11 private static bool activeButton(string label, bool active, Num.Vector4 activeColor) {
12
13 if (active) {
14 ImGui.PushStyleColor(ImGuiCol.Button, activeColor);
15 }
16
17 var result = ImGui.Button(label);
18 // if (ImGui.IsItemHovered()) {
19 // ImGui.SetTooltip("Test");
20
21 // ImGui.EndTooltip();
22 // }
23
24 if (active) {
25 ImGui.PopStyleColor();
26 }
27
28 return result;
29 }
30 public static void Render(ImFontPtr font, int width, ref bool quit, ref bool paused, ref int rate, ref bool show_budget, ref bool show_forest)
11 31 {
12 32 ImGui.PushFont(font);
13 33
@@ -65,6 +85,12
65 85 paused = false;
66 86 rate = 3;
67 87 }
88 #if DEBUG
89 else if (ImGui.MenuItem("5 - Warp", "5", (rate == 4))) {
90 paused = false;
91 rate = 4;
92 }
93 #endif
68 94
69 95
70 96 ImGui.EndMenu();
@@ -80,9 +106,57
80 106 show_forest = !show_forest;
81 107
82 108 }
83
84 109 ImGui.EndMenu();
85 110 }
111 ImGui.SetCursorPosX(width - 400);
112
113 Menu.activeButton("Test", true, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f));
114 if (Menu.activeButton("&Budget", show_budget, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
115 {
116 show_budget = !show_budget;
117
118 }
119 if (Menu.activeButton("Forest", show_forest, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
120 {
121 show_forest = !show_forest;
122
123 }
124
125 ImGui.Text("|");
126
127 if (Menu.activeButton("Pause", paused, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
128 {
129 paused = !paused;
130 }
131 if (Menu.activeButton("1", (rate == 0), new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
132 {
133 paused = false;
134 rate = 0;
135 }
136 else if (Menu.activeButton("2", (rate == 1), new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
137 {
138 paused = false;
139 rate = 1;
140 }
141 else if (Menu.activeButton("3", (rate == 2), new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
142 {
143 paused = false;
144 rate = 2;
145 }
146 else if (Menu.activeButton("4", (rate == 3), new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
147 {
148 paused = false;
149 rate = 3;
150 }
151 #if DEBUG
152 else if (Menu.activeButton("5", (rate == 4), new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
153 {
154 paused = false;
155 rate = 4;
156 }
157 #endif
158
159
86 160 ImGui.EndMainMenuBar();
87 161 // ImGui.Button("Toolbar goes here", new Num.Vector2(0, 37));
88 162
You need to be logged in to leave comments. Login now