Description:
Initial version of News window.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r110:fd886301ca85 -

@@ -0,0 +1,62
1
2 using ImGuiNET;
3
4 using Num = System.Numerics;
5
6 namespace isometricparkfna.UI
7 {
8
9 public static class NewsWindow
10 {
11 public static void Render(ref bool show, ImFontPtr font, Simulation sim)
12 {
13 if (show)
14 {
15 ImGui.PushFont(font);
16
17 ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None;
18 ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 0.0f);
19 ImGui.PushStyleVar(ImGuiStyleVar.WindowRounding, 0.0f);
20 ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 1.0f);
21 ImGui.PushStyleVar(ImGuiStyleVar.TabRounding, 0.0f);
22 ImGui.PushStyleColor(ImGuiCol.WindowBg, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f));
23
24 var title_bar = new Num.Vector4(0.65f, 0.65f, 0.65f, 1f);
25 ImGui.PushStyleColor(ImGuiCol.TitleBg, title_bar);
26 ImGui.PushStyleColor(ImGuiCol.TitleBgActive, title_bar);
27 ImGui.PushStyleColor(ImGuiCol.TitleBgCollapsed, title_bar);
28
29 ImGui.PushStyleColor(ImGuiCol.Border, new Num.Vector4(0f, 0f, 0f, 1f));
30 ImGui.PushStyleColor(ImGuiCol.BorderShadow, new Num.Vector4(0f, 0f, 0f, 0.5f));
31
32
33
34 ImGui.PushStyleColor(ImGuiCol.Button, new Num.Vector4(0.75f, 0.75f, 0.75f, 1f));
35 ImGui.PushStyleColor(ImGuiCol.Text, new Num.Vector4(0f, 0f, 0f, 1f));
36 ImGui.Begin("NEWS", ref show, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings);
37
38 if (ImGui.BeginTabBar("Wire", 0)) {
39 if (ImGui.BeginTabItem("Wire")) {
40 if (ImGui.CollapsingHeader("Headline")) {
41 ImGui.Text("Here's a possible story.");
42 }
43 }
44 }
45
46 ImGui.EndTabBar();
47
48
49 if (ImGui.Button("Okay"))
50 {
51 show = false;
52 }
53
54 ImGui.End();
55 ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left;
56 ImGui.PopStyleVar(4);
57 ImGui.PopStyleColor(8);
58 ImGui.PopFont();
59 }
60 }
61 }
62 }
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,1 +1,1
1 7fc94ca5d2df7983f4c94adbc56e102db8f3e2d1
1 ad27b902b32a3d2cfbb27d0c1e7b420d463b038f
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,1 +1,1
1 6e5464032d916221797274aa2d6596787facae0f
1 4de2e4b51990f2a5aa1f1a207a81fa957b813c4c
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -79,6 +79,7
79 private bool showBudget;
79 private bool showBudget;
80 private BudgetWindow budgetWindow;
80 private BudgetWindow budgetWindow;
81 private bool showForest;
81 private bool showForest;
82 private bool showNews;
82
83
83 private static void Main(string[] args)
84 private static void Main(string[] args)
84 {
85 {
@@ -134,6 +135,7
134 messageIndex = 0;
135 messageIndex = 0;
135 showBudget = false;
136 showBudget = false;
136 showForest = true;
137 showForest = true;
138 showNews = true;
137 showGrid = true;
139 showGrid = true;
138
140
139 this.Window.Title = "Isometric Park";
141 this.Window.Title = "Isometric Park";
@@ -349,6 +351,11
349 this.showForest = !this.showForest;
351 this.showForest = !this.showForest;
350
352
351 }
353 }
354 if (keyboardCur.IsKeyDown(Keys.N) && keyboardPrev.IsKeyUp(Keys.N))
355 {
356 this.showNews = !this.showNews;
357
358 }
352 if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C))
359 if (keyboardCur.IsKeyDown(Keys.C) && keyboardPrev.IsKeyUp(Keys.C))
353 {
360 {
354 this.camera.Jump(Vector2.Zero);
361 this.camera.Jump(Vector2.Zero);
@@ -872,9 +879,14
872 ForestWindow.Render(ref this.showForest, debugWindow.monoFont, this.simulation);
879 ForestWindow.Render(ref this.showForest, debugWindow.monoFont, this.simulation);
873 }
880 }
874
881
882 if (this.showNews)
883 {
884 NewsWindow.Render(ref this.showNews, debugWindow.monoFont, this.simulation);
885 }
886
875 bool quit = false;
887 bool quit = false;
876 Menu.Render(debugWindow.monoFont, FNAGame.width, ref quit, ref this.simulation.paused, ref this.simulation.currentRate,
888 Menu.Render(debugWindow.monoFont, FNAGame.width, ref quit, ref this.simulation.paused, ref this.simulation.currentRate,
877 ref this.showBudget, ref this.showForest, header_left);
889 ref this.showBudget, ref this.showNews, ref this.showForest, header_left);
878
890
879 if (quit) {
891 if (quit) {
880 System.Environment.Exit(0);
892 System.Environment.Exit(0);
@@ -22,7 +22,7
22
22
23 return result;
23 return result;
24 }
24 }
25 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, string header)
25 public static void Render(ImFontPtr font, int width, ref bool quit, ref bool paused, ref int rate, ref bool show_budget, ref bool show_news, ref bool show_forest, string header)
26 {
26 {
27 ImGui.PushFont(font);
27 ImGui.PushFont(font);
28
28
@@ -61,6 +61,11
61 }
61 }
62 if (Menu.activeButton("\ue124 Forest", show_forest, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
62 if (Menu.activeButton("\ue124 Forest", show_forest, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
63 {
63 {
64 show_news = !show_news;
65
66 }
67 if (Menu.activeButton("! News", show_forest, new Num.Vector4(0.060f, 0.590f, 0.980f, 1f)))
68 {
64 show_forest = !show_forest;
69 show_forest = !show_forest;
65
70
66 }
71 }
@@ -110,4 +115,4
110 }
115 }
111 }
116 }
112 }
117 }
113 } No newline at end of file
118 }
@@ -49,6 +49,7
49 <Compile Include="UI\Dialog.cs" />
49 <Compile Include="UI\Dialog.cs" />
50 <Compile Include="UI\ForestWindow.cs" />
50 <Compile Include="UI\ForestWindow.cs" />
51 <Compile Include="UI\Menu.cs" />
51 <Compile Include="UI\Menu.cs" />
52 <Compile Include="UI\NewsWindow.cs" />
52 </ItemGroup>
53 </ItemGroup>
53 <ItemGroup>
54 <ItemGroup>
54 <ProjectReference Include="..\FNA\FNA.csproj">
55 <ProjectReference Include="..\FNA\FNA.csproj">
You need to be logged in to leave comments. Login now