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 | 48 | ImGuiColor.BLUE, ImGuiColor.DARKGREY, ImGuiColor.LIGHTRED, ImGuiColor.LIGHTGREEN, |
|
49 | 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 | 52 | .Concat(money_series) |
|
53 | 53 | .Concat(tree_series) |
|
54 | 54 | .Zip(colors, (first, second) => (first, second)) |
@@ -63,7 +63,7 | |||
|
63 | 63 | var tick_position = position; |
|
64 | 64 | |
|
65 | 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 | 68 | if (vertical) { |
|
69 | 69 | tick_position = new Num.Vector2(position.X, position.Y + ((i + 1) * tick_spacing)); |
@@ -76,7 +76,7 | |||
|
76 | 76 | } |
|
77 | 77 | |
|
78 | 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 | 80 | var tick_length = 5; |
|
81 | 81 | var tick_adjust = vertical ? new Num.Vector2(tick_length, 0) : new Num.Vector2(0, tick_length); |
|
82 | 82 | |
@@ -86,7 +86,7 | |||
|
86 | 86 | for(int i = 0; i < labels; i++) { |
|
87 | 87 | var value = Scale(range, domain, (int)(vertical ? tick_position.Y : tick_position.X)); |
|
88 | 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 | 90 | //Logging.Info(String.Format("Drawing {0:} at {1} ({2})", label, tick_absolute_position, tick_position)); |
|
91 | 91 | |
|
92 | 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 | 106 | var p = Num.Vector2.Zero; |
|
107 | 107 | |
|
108 | 108 | for (int i = 0; i < points.Length; i++) |
@@ -110,7 +110,7 | |||
|
110 | 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 | 116 | public static int Scale(Num.Vector2 domain, Num.Vector2 range, int num) { |
@@ -129,7 +129,6 | |||
|
129 | 129 | { |
|
130 | 130 | bool newShow = true; |
|
131 | 131 | |
|
132 | ||
|
133 | 132 | ImGui.PushFont(font); |
|
134 | 133 | |
|
135 | 134 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; |
@@ -254,12 +253,12 | |||
|
254 | 253 | //Y Axis |
|
255 | 254 | draw_list.AddLine(Num.Vector2.Add(new Num.Vector2(padding, padding), c), |
|
256 | 255 | Num.Vector2.Add(new Num.Vector2(padding, 200), c), |
|
257 | ImGuiColor.LIGHTGREY, 0.0f); | |
|
256 | (uint)ImGuiColor.LIGHTGREY, 0.0f); | |
|
258 | 257 | |
|
259 | 258 | //X Axis |
|
260 | 259 | draw_list.AddLine(Num.Vector2.Add(new Num.Vector2(padding, 200 -padding), c), |
|
261 | 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 | 263 | foreach (var key in keys) |
|
265 | 264 | { |
@@ -289,7 +288,7 | |||
|
289 | 288 | var data_array2 = data_array.Select((p, i) => new Num.Vector2(Scale(x_domain, x_range, i), p)).ToArray(); |
|
290 | 289 | |
|
291 | 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 | 296 | DrawLinearLabels(font, draw_list, domain, range /*new Num.Vector2(0, 200)*/, true, 10, c); |
|
298 | 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 | 301 | ImGui.End(); |
|
303 | 302 | ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left; |
@@ -1,8 +1,8 | |||
|
1 | 1 | |
|
2 | 2 | namespace isometricparkfna.UI { |
|
3 | 3 | |
|
4 | enum ImGuiColor : uint { | |
|
5 |
BLACK = 0xFF |
|
|
4 | public enum ImGuiColor : uint { | |
|
5 | BLACK = 0xFF000000, | |
|
6 | 6 | RED = 0xFFFF0000, |
|
7 | 7 | GREEN = 0xFF00FF00, |
|
8 | 8 | BLUE = 0xFF0000FF, |
@@ -10,7 +10,8 | |||
|
10 | 10 | LIGHTRED = 0xFFAA0000, |
|
11 | 11 | LIGHTGREEN = 0xFF00AA00, |
|
12 | 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