From dd2e085179272ca12dd24d8973e39b4ec250af66 Mon Sep 17 00:00:00 2001 From: Eric Mellino Date: Mon, 18 Jun 2018 20:23:26 -0700 Subject: [PATCH] Add a better PlotHistogram overload, and deprecate the old one. --- src/ImGui.NET/ImGui.cs | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/ImGui.NET/ImGui.cs b/src/ImGui.NET/ImGui.cs index 90b10bd..94a63ac 100644 --- a/src/ImGui.NET/ImGui.cs +++ b/src/ImGui.NET/ImGui.cs @@ -294,7 +294,16 @@ namespace ImGuiNET ImGuiNative.igShowFontSelector(label); } - public unsafe static void PlotHistogram(string label, float[] values, int valuesOffset, string overlayText, float scaleMin, float scaleMax, Vector2 graphSize, int stride) + [Obsolete("This PlotHistogram overload is deprecated. Use the overload accepting a startIndex and count.")] + public unsafe static void PlotHistogram( + string label, + float[] values, + int valuesOffset, + string overlayText, + float scaleMin, + float scaleMax, + Vector2 graphSize, + int stride) { fixed (float* valuesBasePtr = values) { @@ -311,6 +320,32 @@ namespace ImGuiNET } } + public unsafe static void PlotHistogram( + string label, + float[] values, + int startIndex, + int count, + string overlayText = null, + float scaleMin = float.MaxValue, + float scaleMax = float.MaxValue, + Vector2 graphSize = default(Vector2), + int elementStride = sizeof(float)) + { + fixed (float* valuesBasePtr = values) + { + ImGuiNative.igPlotHistogram( + label, + valuesBasePtr, + count, + startIndex, + overlayText, + scaleMin, + scaleMax, + graphSize, + elementStride * sizeof(float)); + } + } + public static bool SliderFloat(string sliderLabel, ref float value, float min, float max, string displayText, float power) { return ImGuiNative.igSliderFloat(sliderLabel, ref value, min, max, displayText, power);