Description:
Add Graph file I missed.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -0,0 +1,62 | |||
|
1 | ||
|
2 | using System; | |
|
3 | using Num = System.Numerics; | |
|
4 | using System.Linq; | |
|
5 | using System.Runtime.InteropServices; | |
|
6 | ||
|
7 | using ImGuiNET; | |
|
8 | ||
|
9 | using isometricparkfna.Messages; | |
|
10 | using isometricparkfna.Components; | |
|
11 | using isometricparkfna.Engines; | |
|
12 | ||
|
13 | namespace isometricparkfna.UI | |
|
14 | { | |
|
15 | ||
|
16 | public static class GraphWindow | |
|
17 | { | |
|
18 | public static bool hadFocus = false; | |
|
19 | ||
|
20 | public static void Render(ImFontPtr font, Simulation sim, ImGuiWindowBridgeEngine engine) | |
|
21 | { | |
|
22 | bool newShow = true; | |
|
23 | ImGui.PushFont(font); | |
|
24 | ||
|
25 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; | |
|
26 | StyleSets.defaultSet.push(); | |
|
27 | ||
|
28 | if(GraphWindow.hadFocus) | |
|
29 | { | |
|
30 | ImGui.PushStyleColor(ImGuiCol.Text, StyleSets.white); | |
|
31 | } | |
|
32 | ImGui.SetNextWindowSize(new Num.Vector2(400, 250)); | |
|
33 | ||
|
34 | ImGui.Begin("Graph", ref newShow, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoSavedSettings); | |
|
35 | if (GraphWindow.hadFocus) | |
|
36 | { | |
|
37 | ImGui.PopStyleColor(); | |
|
38 | } | |
|
39 | GraphWindow.hadFocus = ImGui.IsWindowFocused(); | |
|
40 | ||
|
41 | // ImGui.Text("Lorem Ipsum"); | |
|
42 | ||
|
43 | var totals = sim.allBudgets().Select(b => (float)b.money).ToArray(); | |
|
44 | ||
|
45 | ||
|
46 | ||
|
47 | if (totals.Length > 0) | |
|
48 | { | |
|
49 | ImGui.PlotLines("MainGraph", ref totals[0], totals.Length, 0, null, float.MaxValue, float.MaxValue, new Num.Vector2(350, 200)); | |
|
50 | } | |
|
51 | ||
|
52 | ||
|
53 | ||
|
54 | ||
|
55 | ImGui.End(); | |
|
56 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left; | |
|
57 | StyleSets.defaultSet.pop(); | |
|
58 | ImGui.PopFont(); | |
|
59 | ||
|
60 | } | |
|
61 | } | |
|
62 | } |
You need to be logged in to leave comments.
Login now