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 @@ -388,6 +388,13 @@ this.simulation.paused = false; this.simulation.setRate(3); } + #if DEBUG + if (keyboardCur.IsKeyDown(Keys.D5) && keyboardPrev.IsKeyUp(Keys.D5) ) + { + this.simulation.paused = false; + this.simulation.setRate(4); + } + #endif #endregion gamerate_keys #if DEBUG @@ -396,18 +403,6 @@ - - //if (keyboardCur.IsKeyDown(Keys.P) && keyboardPrev.IsKeyUp(Keys.P)) - // { - // this.player_state = !this.player_state; - // } - - //if (player_state ) - //{ - // MediaPlayer.Play(music); - //} - - MouseState mouseCur = Mouse.GetState(); this.original_point = Vector2.Transform(new Vector2(mouseCur.X, mouseCur.Y), Matrix.Invert(camera.get_transformation(GraphicsDevice))); @@ -869,7 +864,7 @@ } bool quit = false; - Menu.Render(debugWindow.monoFont, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, + Menu.Render(debugWindow.monoFont, FNAGame.width, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, ref this.showForest); if (quit) { diff --git a/isometric-park-fna/UI/Menu.cs b/isometric-park-fna/UI/Menu.cs --- a/isometric-park-fna/UI/Menu.cs +++ b/isometric-park-fna/UI/Menu.cs @@ -7,7 +7,27 @@ public static class Menu { - public static void Render(ImFontPtr font, ref bool quit, ref bool paused, ref int rate, ref bool show_budget, ref bool show_forest) + + private static bool activeButton(string label, bool active, Num.Vector4 activeColor) { + + if (active) { + ImGui.PushStyleColor(ImGuiCol.Button, activeColor); + } + + var result = ImGui.Button(label); + // if (ImGui.IsItemHovered()) { + // ImGui.SetTooltip("Test"); + + // ImGui.EndTooltip(); + // } + + if (active) { + ImGui.PopStyleColor(); + } + + return result; + } + 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) { ImGui.PushFont(font); @@ -65,6 +85,12 @@ paused = false; rate = 3; } + #if DEBUG + else if (ImGui.MenuItem("5 - Warp", "5", (rate == 4))) { + paused = false; + rate = 4; + } + #endif ImGui.EndMenu(); @@ -80,9 +106,57 @@ show_forest = !show_forest; } - ImGui.EndMenu(); } + ImGui.SetCursorPosX(width - 400); + + Menu.activeButton("Test", true, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)); + if (Menu.activeButton("&Budget", show_budget, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f))) + { + show_budget = !show_budget; + + } + if (Menu.activeButton("Forest", show_forest, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f))) + { + show_forest = !show_forest; + + } + + ImGui.Text("|"); + + if (Menu.activeButton("Pause", paused, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f))) + { + paused = !paused; + } + if (Menu.activeButton("1", (rate == 0), new Num.Vector4(0.060f, 0.590f, 0.980f, 1f))) + { + paused = false; + rate = 0; + } + else if (Menu.activeButton("2", (rate == 1), new Num.Vector4(0.060f, 0.590f, 0.980f, 1f))) + { + paused = false; + rate = 1; + } + else if (Menu.activeButton("3", (rate == 2), new Num.Vector4(0.060f, 0.590f, 0.980f, 1f))) + { + paused = false; + rate = 2; + } + else if (Menu.activeButton("4", (rate == 3), new Num.Vector4(0.060f, 0.590f, 0.980f, 1f))) + { + paused = false; + rate = 3; + } +#if DEBUG + else if (Menu.activeButton("5", (rate == 4), new Num.Vector4(0.060f, 0.590f, 0.980f, 1f))) + { + paused = false; + rate = 4; + } +#endif + + ImGui.EndMainMenuBar(); // ImGui.Button("Toolbar goes here", new Num.Vector2(0, 37));