Description:
Fix type issues caused by introduction of enum.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -44,11 +44,11 | |||||
|
44 |
|
44 | ||
|
45 |
|
45 | ||
|
46 |
|
46 | ||
|
47 |
public static |
|
47 | public static ImGuiColor[] colors = { ImGuiColor.BLACK, ImGuiColor.RED, ImGuiColor.GREEN, |
|
48 | ImGuiColor.BLUE, ImGuiColor.DARKGREY, ImGuiColor.LIGHTRED, ImGuiColor.LIGHTGREEN, |
|
48 | ImGuiColor.BLUE, ImGuiColor.DARKGREY, ImGuiColor.LIGHTRED, ImGuiColor.LIGHTGREEN, |
|
49 | ImGuiColor.LIGHTBLUE, ImGuiColor.BLACK }; |
|
49 | ImGuiColor.LIGHTBLUE, ImGuiColor.BLACK }; |
|
50 |
|
50 | ||
|
51 |
public static Dictionary<string, |
|
51 | public static Dictionary<string, ImGuiColor> data_sets_color = new List<string>() |
|
52 | .Concat(money_series) |
|
52 | .Concat(money_series) |
|
53 | .Concat(tree_series) |
|
53 | .Concat(tree_series) |
|
54 | .Zip(colors, (first, second) => (first, second)) |
|
54 | .Zip(colors, (first, second) => (first, second)) |
@@ -63,7 +63,7 | |||||
|
63 | var tick_position = position; |
|
63 | var tick_position = position; |
|
64 |
|
64 | ||
|
65 | for(int i = 0; i < points; i++) { |
|
65 | for(int i = 0; i < points; i++) { |
|
66 | draw_list.AddLine(tick_position, Num.Vector2.Add(tick_position, tick_adjust), ImGuiColor.LIGHTGREY, 1.0f); |
|
66 | draw_list.AddLine(tick_position, Num.Vector2.Add(tick_position, tick_adjust), (uint)ImGuiColor.LIGHTGREY, 1.0f); |
|
67 |
|
67 | ||
|
68 | if (vertical) { |
|
68 | if (vertical) { |
|
69 | tick_position = new Num.Vector2(position.X, position.Y + ((i + 1) * tick_spacing)); |
|
69 | tick_position = new Num.Vector2(position.X, position.Y + ((i + 1) * tick_spacing)); |
@@ -76,7 +76,7 | |||||
|
76 | } |
|
76 | } |
|
77 |
|
77 | ||
|
78 | public static async void DrawLinearLabels(ImFontPtr font, ImDrawListPtr draw_list, Num.Vector2 domain, Num.Vector2 range, bool vertical, int labels, Num.Vector2 starting_position) { |
|
78 | public static async void DrawLinearLabels(ImFontPtr font, ImDrawListPtr draw_list, Num.Vector2 domain, Num.Vector2 range, bool vertical, int labels, Num.Vector2 starting_position) { |
|
79 | var tick_spacing = (int)Math.Abs((range.Y - range.X) / labels); |
|
79 | var tick_spacing = (int)Math.Abs((range.Y - range.X) / (labels)); |
|
80 | var tick_length = 5; |
|
80 | var tick_length = 5; |
|
81 | var tick_adjust = vertical ? new Num.Vector2(tick_length, 0) : new Num.Vector2(0, tick_length); |
|
81 | var tick_adjust = vertical ? new Num.Vector2(tick_length, 0) : new Num.Vector2(0, tick_length); |
|
82 |
|
82 | ||
@@ -86,7 +86,7 | |||||
|
86 | for(int i = 0; i < labels; i++) { |
|
86 | for(int i = 0; i < labels; i++) { |
|
87 | var value = Scale(range, domain, (int)(vertical ? tick_position.Y : tick_position.X)); |
|
87 | var value = Scale(range, domain, (int)(vertical ? tick_position.Y : tick_position.X)); |
|
88 | var label = String.Format("{0}", value); |
|
88 | var label = String.Format("{0}", value); |
|
89 | draw_list.AddText(font, 11.0f, tick_absolute_position, ImGuiColor.BLACK, label); |
|
89 | draw_list.AddText(font, 11.0f, tick_absolute_position, (uint)ImGuiColor.BLACK, label); |
|
90 | //Logging.Info(String.Format("Drawing {0:} at {1} ({2})", label, tick_absolute_position, tick_position)); |
|
90 | //Logging.Info(String.Format("Drawing {0:} at {1} ({2})", label, tick_absolute_position, tick_position)); |
|
91 |
|
91 | ||
|
92 | if (vertical) { |
|
92 | if (vertical) { |
@@ -102,7 +102,7 | |||||
|
102 | } |
|
102 | } |
|
103 |
|
103 | ||
|
104 |
|
104 | ||
|
105 |
public static void DrawLine(ImDrawListPtr draw_list, Num.Vector2 c, Num.Vector2[] points, |
|
105 | public static void DrawLine(ImDrawListPtr draw_list, Num.Vector2 c, Num.Vector2[] points, ImGuiColor col) { |
|
106 | var p = Num.Vector2.Zero; |
|
106 | var p = Num.Vector2.Zero; |
|
107 |
|
107 | ||
|
108 | for (int i = 0; i < points.Length; i++) |
|
108 | for (int i = 0; i < points.Length; i++) |
@@ -110,7 +110,7 | |||||
|
110 | points[i] = Num.Vector2.Add(points[i], c); |
|
110 | points[i] = Num.Vector2.Add(points[i], c); |
|
111 | } |
|
111 | } |
|
112 |
|
112 | ||
|
113 | draw_list.AddPolyline(ref points[0], points.Length, col, 0 /*ImDrawFlags.RoundCornersDefault*/, 1.0f); |
|
113 | draw_list.AddPolyline(ref points[0], points.Length, (uint)col, 0 /*ImDrawFlags.RoundCornersDefault*/, 1.0f); |
|
114 | } |
|
114 | } |
|
115 |
|
115 | ||
|
116 | public static int Scale(Num.Vector2 domain, Num.Vector2 range, int num) { |
|
116 | public static int Scale(Num.Vector2 domain, Num.Vector2 range, int num) { |
@@ -129,7 +129,6 | |||||
|
129 | { |
|
129 | { |
|
130 | bool newShow = true; |
|
130 | bool newShow = true; |
|
131 |
|
131 | ||
|
132 |
|
|||
|
133 | ImGui.PushFont(font); |
|
132 | ImGui.PushFont(font); |
|
134 |
|
133 | ||
|
135 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; |
|
134 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; |
@@ -254,12 +253,12 | |||||
|
254 | //Y Axis |
|
253 | //Y Axis |
|
255 | draw_list.AddLine(Num.Vector2.Add(new Num.Vector2(padding, padding), c), |
|
254 | draw_list.AddLine(Num.Vector2.Add(new Num.Vector2(padding, padding), c), |
|
256 | Num.Vector2.Add(new Num.Vector2(padding, 200), c), |
|
255 | Num.Vector2.Add(new Num.Vector2(padding, 200), c), |
|
257 | ImGuiColor.LIGHTGREY, 0.0f); |
|
256 | (uint)ImGuiColor.LIGHTGREY, 0.0f); |
|
258 |
|
257 | ||
|
259 | //X Axis |
|
258 | //X Axis |
|
260 | draw_list.AddLine(Num.Vector2.Add(new Num.Vector2(padding, 200 -padding), c), |
|
259 | draw_list.AddLine(Num.Vector2.Add(new Num.Vector2(padding, 200 -padding), c), |
|
261 | Num.Vector2.Add(new Num.Vector2(350, 200 - padding), c), |
|
260 | Num.Vector2.Add(new Num.Vector2(350, 200 - padding), c), |
|
262 | ImGuiColor.LIGHTGREY, 1.0f); |
|
261 | (uint)ImGuiColor.LIGHTGREY, 1.0f); |
|
263 |
|
262 | ||
|
264 | foreach (var key in keys) |
|
263 | foreach (var key in keys) |
|
265 | { |
|
264 | { |
@@ -289,7 +288,7 | |||||
|
289 | var data_array2 = data_array.Select((p, i) => new Num.Vector2(Scale(x_domain, x_range, i), p)).ToArray(); |
|
288 | var data_array2 = data_array.Select((p, i) => new Num.Vector2(Scale(x_domain, x_range, i), p)).ToArray(); |
|
290 |
|
289 | ||
|
291 | DrawLine(draw_list, c, data_array2, color); |
|
290 | DrawLine(draw_list, c, data_array2, color); |
|
292 | draw_list.AddText(font, 12, data_array2.Last(), color, key); |
|
291 | draw_list.AddText(font, 12, data_array2.Last(), (uint)color, key); |
|
293 | } |
|
292 | } |
|
294 | } |
|
293 | } |
|
295 |
|
294 | ||
@@ -297,7 +296,7 | |||||
|
297 | DrawLinearLabels(font, draw_list, domain, range /*new Num.Vector2(0, 200)*/, true, 10, c); |
|
296 | DrawLinearLabels(font, draw_list, domain, range /*new Num.Vector2(0, 200)*/, true, 10, c); |
|
298 | DrawLinearAxis(draw_list, new Num.Vector2(0, 350), false, 12, Num.Vector2.Add(c, new Num.Vector2(padding, 200 - padding))); |
|
297 | DrawLinearAxis(draw_list, new Num.Vector2(0, 350), false, 12, Num.Vector2.Add(c, new Num.Vector2(padding, 200 - padding))); |
|
299 |
|
298 | ||
|
300 |
ImGui.Dummy(new Num.Vector2(350, 2 |
|
299 | ImGui.Dummy(new Num.Vector2(350, 200)); |
|
301 |
|
300 | ||
|
302 | ImGui.End(); |
|
301 | ImGui.End(); |
|
303 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left; |
|
302 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left; |
@@ -1,8 +1,8 | |||||
|
1 |
|
1 | ||
|
2 | namespace isometricparkfna.UI { |
|
2 | namespace isometricparkfna.UI { |
|
3 |
|
3 | ||
|
4 | enum ImGuiColor : uint { |
|
4 | public enum ImGuiColor : uint { |
|
5 |
BLACK = 0xFF |
|
5 | BLACK = 0xFF000000, |
|
6 | RED = 0xFFFF0000, |
|
6 | RED = 0xFFFF0000, |
|
7 | GREEN = 0xFF00FF00, |
|
7 | GREEN = 0xFF00FF00, |
|
8 | BLUE = 0xFF0000FF, |
|
8 | BLUE = 0xFF0000FF, |
@@ -10,7 +10,8 | |||||
|
10 | LIGHTRED = 0xFFAA0000, |
|
10 | LIGHTRED = 0xFFAA0000, |
|
11 | LIGHTGREEN = 0xFF00AA00, |
|
11 | LIGHTGREEN = 0xFF00AA00, |
|
12 | LIGHTBLUE = 0xFF0000AA, |
|
12 | LIGHTBLUE = 0xFF0000AA, |
|
13 | LIGHTGREY = 0xFFAAAAAA |
|
13 | LIGHTGREY = 0xFFAAAAAA, |
|
|
14 | WHITE = 0xFF000000, | ||
|
14 |
|
15 | ||
|
15 | } |
|
16 | } |
|
16 |
|
17 |
You need to be logged in to leave comments.
Login now