diff --git a/isometric-park-fna/UI/Graph.cs b/isometric-park-fna/UI/Graph.cs --- a/isometric-park-fna/UI/Graph.cs +++ b/isometric-park-fna/UI/Graph.cs @@ -44,11 +44,11 @@ - public static uint[] colors = { ImGuiColor.BLACK, ImGuiColor.RED, ImGuiColor.GREEN, + public static ImGuiColor[] colors = { ImGuiColor.BLACK, ImGuiColor.RED, ImGuiColor.GREEN, ImGuiColor.BLUE, ImGuiColor.DARKGREY, ImGuiColor.LIGHTRED, ImGuiColor.LIGHTGREEN, ImGuiColor.LIGHTBLUE, ImGuiColor.BLACK }; - public static Dictionary data_sets_color = new List() + public static Dictionary data_sets_color = new List() .Concat(money_series) .Concat(tree_series) .Zip(colors, (first, second) => (first, second)) @@ -63,7 +63,7 @@ var tick_position = position; for(int i = 0; i < points; i++) { - draw_list.AddLine(tick_position, Num.Vector2.Add(tick_position, tick_adjust), ImGuiColor.LIGHTGREY, 1.0f); + draw_list.AddLine(tick_position, Num.Vector2.Add(tick_position, tick_adjust), (uint)ImGuiColor.LIGHTGREY, 1.0f); if (vertical) { tick_position = new Num.Vector2(position.X, position.Y + ((i + 1) * tick_spacing)); @@ -76,7 +76,7 @@ } public static async void DrawLinearLabels(ImFontPtr font, ImDrawListPtr draw_list, Num.Vector2 domain, Num.Vector2 range, bool vertical, int labels, Num.Vector2 starting_position) { - var tick_spacing = (int)Math.Abs((range.Y - range.X) / labels); + var tick_spacing = (int)Math.Abs((range.Y - range.X) / (labels)); var tick_length = 5; var tick_adjust = vertical ? new Num.Vector2(tick_length, 0) : new Num.Vector2(0, tick_length); @@ -86,7 +86,7 @@ for(int i = 0; i < labels; i++) { var value = Scale(range, domain, (int)(vertical ? tick_position.Y : tick_position.X)); var label = String.Format("{0}", value); - draw_list.AddText(font, 11.0f, tick_absolute_position, ImGuiColor.BLACK, label); + draw_list.AddText(font, 11.0f, tick_absolute_position, (uint)ImGuiColor.BLACK, label); //Logging.Info(String.Format("Drawing {0:} at {1} ({2})", label, tick_absolute_position, tick_position)); if (vertical) { @@ -102,7 +102,7 @@ } - public static void DrawLine(ImDrawListPtr draw_list, Num.Vector2 c, Num.Vector2[] points, uint col) { + public static void DrawLine(ImDrawListPtr draw_list, Num.Vector2 c, Num.Vector2[] points, ImGuiColor col) { var p = Num.Vector2.Zero; for (int i = 0; i < points.Length; i++) @@ -110,7 +110,7 @@ points[i] = Num.Vector2.Add(points[i], c); } - draw_list.AddPolyline(ref points[0], points.Length, col, 0 /*ImDrawFlags.RoundCornersDefault*/, 1.0f); + draw_list.AddPolyline(ref points[0], points.Length, (uint)col, 0 /*ImDrawFlags.RoundCornersDefault*/, 1.0f); } public static int Scale(Num.Vector2 domain, Num.Vector2 range, int num) { @@ -129,7 +129,6 @@ { bool newShow = true; - ImGui.PushFont(font); ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.None; @@ -254,12 +253,12 @@ //Y Axis draw_list.AddLine(Num.Vector2.Add(new Num.Vector2(padding, padding), c), Num.Vector2.Add(new Num.Vector2(padding, 200), c), - ImGuiColor.LIGHTGREY, 0.0f); + (uint)ImGuiColor.LIGHTGREY, 0.0f); //X Axis draw_list.AddLine(Num.Vector2.Add(new Num.Vector2(padding, 200 -padding), c), Num.Vector2.Add(new Num.Vector2(350, 200 - padding), c), - ImGuiColor.LIGHTGREY, 1.0f); + (uint)ImGuiColor.LIGHTGREY, 1.0f); foreach (var key in keys) { @@ -289,7 +288,7 @@ var data_array2 = data_array.Select((p, i) => new Num.Vector2(Scale(x_domain, x_range, i), p)).ToArray(); DrawLine(draw_list, c, data_array2, color); - draw_list.AddText(font, 12, data_array2.Last(), color, key); + draw_list.AddText(font, 12, data_array2.Last(), (uint)color, key); } } @@ -297,7 +296,7 @@ DrawLinearLabels(font, draw_list, domain, range /*new Num.Vector2(0, 200)*/, true, 10, c); DrawLinearAxis(draw_list, new Num.Vector2(0, 350), false, 12, Num.Vector2.Add(c, new Num.Vector2(padding, 200 - padding))); - ImGui.Dummy(new Num.Vector2(350, 250)); + ImGui.Dummy(new Num.Vector2(350, 200)); ImGui.End(); ImGui.GetStyle().WindowMenuButtonPosition = ImGuiDir.Left; diff --git a/isometric-park-fna/UI/ImGuiColor.cs b/isometric-park-fna/UI/ImGuiColor.cs --- a/isometric-park-fna/UI/ImGuiColor.cs +++ b/isometric-park-fna/UI/ImGuiColor.cs @@ -1,8 +1,8 @@ namespace isometricparkfna.UI { - enum ImGuiColor : uint { - BLACK = 0xFFFFFFFF, + public enum ImGuiColor : uint { + BLACK = 0xFF000000, RED = 0xFFFF0000, GREEN = 0xFF00FF00, BLUE = 0xFF0000FF, @@ -10,7 +10,8 @@ LIGHTRED = 0xFFAA0000, LIGHTGREEN = 0xFF00AA00, LIGHTBLUE = 0xFF0000AA, - LIGHTGREY = 0xFFAAAAAA + LIGHTGREY = 0xFFAAAAAA, + WHITE = 0xFF000000, }