Description:
Add first version of Forest Policy window.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -0,0 +1,56 | |||||
|
|
1 | using ImGuiNET; | ||
|
|
2 | |||
|
|
3 | using Num = System.Numerics; | ||
|
|
4 | |||
|
|
5 | namespace isometricparkfna.UI | ||
|
|
6 | { | ||
|
|
7 | |||
|
|
8 | public static class ForestWindow | ||
|
|
9 | { | ||
|
|
10 | public static void Render(ref bool show, ImFontPtr font, Simulation sim) | ||
|
|
11 | { | ||
|
|
12 | if (show) | ||
|
|
13 | { | ||
|
|
14 | ImGui.PushFont(font); | ||
|
|
15 | |||
|
|
16 | ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 0.0f); | ||
|
|
17 | ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0f); | ||
|
|
18 | ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 1.0f); | ||
|
|
19 | ImGui.PushStyleColor(ImGuiCol.WindowBg, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); | ||
|
|
20 | |||
|
|
21 | var title_bar = new Num.Vector4(0.65f, 0.65f, 0.65f, 1f); | ||
|
|
22 | ImGui.PushStyleColor(ImGuiCol.TitleBg, title_bar); | ||
|
|
23 | ImGui.PushStyleColor(ImGuiCol.TitleBgActive, title_bar); | ||
|
|
24 | ImGui.PushStyleColor(ImGuiCol.TitleBgCollapsed, title_bar); | ||
|
|
25 | |||
|
|
26 | ImGui.PushStyleColor(ImGuiCol.Border, new Num.Vector4(0f, 0f, 0f, 1f)); | ||
|
|
27 | ImGui.PushStyleColor(ImGuiCol.BorderShadow, new Num.Vector4(0f, 0f, 0f, 0.5f)); | ||
|
|
28 | |||
|
|
29 | |||
|
|
30 | |||
|
|
31 | ImGui.PushStyleColor(ImGuiCol.Button, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f)); | ||
|
|
32 | ImGui.PushStyleColor(ImGuiCol.Text, new Num.Vector4(0f, 0f, 0f, 1f)); | ||
|
|
33 | ImGui.Begin("Forest Policy", ref show); | ||
|
|
34 | |||
|
|
35 | |||
|
|
36 | int new_tree_planting = sim.tree_planting; | ||
|
|
37 | ImGui.SliderInt("Tree Planting ($100 ea.)", ref new_tree_planting, 0, 25); | ||
|
|
38 | sim.tree_planting = new_tree_planting; | ||
|
|
39 | |||
|
|
40 | int new_tree_clearing = sim.tree_clearing; | ||
|
|
41 | ImGui.SliderInt("Tree Clearing ($100 ea.)", ref new_tree_clearing, 0, 25); | ||
|
|
42 | sim.tree_clearing = new_tree_clearing; | ||
|
|
43 | |||
|
|
44 | if (ImGui.Button("Okay")) | ||
|
|
45 | { | ||
|
|
46 | show = false; | ||
|
|
47 | } | ||
|
|
48 | |||
|
|
49 | ImGui.End(); | ||
|
|
50 | ImGui.PopStyleVar(3); | ||
|
|
51 | ImGui.PopStyleColor(8); | ||
|
|
52 | ImGui.PopFont(); | ||
|
|
53 | } | ||
|
|
54 | } | ||
|
|
55 | } | ||
|
|
56 | } No newline at end of file |
@@ -83,6 +83,7 | |||||
|
83 | private GraphicsDeviceManager gdm; |
|
83 | private GraphicsDeviceManager gdm; |
|
84 | private bool showBudget; |
|
84 | private bool showBudget; |
|
85 | private BudgetWindow budgetWindow; |
|
85 | private BudgetWindow budgetWindow; |
|
|
86 | private bool showForest; | ||
|
86 |
|
87 | ||
|
87 | private static void Main(string[] args) |
|
88 | private static void Main(string[] args) |
|
88 | { |
|
89 | { |
@@ -131,6 +132,7 | |||||
|
131 | showInitial = true; |
|
132 | showInitial = true; |
|
132 | messageIndex = 0; |
|
133 | messageIndex = 0; |
|
133 | showBudget = false; |
|
134 | showBudget = false; |
|
|
135 | showForest = true; | ||
|
134 | showGrid = true; |
|
136 | showGrid = true; |
|
135 |
|
137 | ||
|
136 | this.Window.Title = "Isometric Park"; |
|
138 | this.Window.Title = "Isometric Park"; |
@@ -830,6 +832,8 | |||||
|
830 | ref this.simulation.paused, debugWindow.monoFont, this.currentNode); |
|
832 | ref this.simulation.paused, debugWindow.monoFont, this.currentNode); |
|
831 | } |
|
833 | } |
|
832 |
|
834 | ||
|
|
835 | ForestWindow.Render(ref this.showForest, debugWindow.monoFont, this.simulation); | ||
|
|
836 | |||
|
833 |
|
837 | ||
|
834 | _imGuiRenderer.AfterLayout(); |
|
838 | _imGuiRenderer.AfterLayout(); |
|
835 |
|
839 |
@@ -48,6 +48,7 | |||||
|
48 | <Compile Include="UI\BudgetWindow.cs" /> |
|
48 | <Compile Include="UI\BudgetWindow.cs" /> |
|
49 | <Compile Include="UI\DebugWindow.cs" /> |
|
49 | <Compile Include="UI\DebugWindow.cs" /> |
|
50 | <Compile Include="UI\Dialog.cs" /> |
|
50 | <Compile Include="UI\Dialog.cs" /> |
|
|
51 | <Compile Include="UI\ForestWindow.cs" /> | ||
|
51 | </ItemGroup> |
|
52 | </ItemGroup> |
|
52 | <ItemGroup> |
|
53 | <ItemGroup> |
|
53 | <ProjectReference Include="..\FNA\FNA.csproj"> |
|
54 | <ProjectReference Include="..\FNA\FNA.csproj"> |
You need to be logged in to leave comments.
Login now