private void DrawFloatSlider(IVariable variable, string sliderLabel, float fallbackMin, float fallbackMax, string displayText) { var minMaxFilter = variable.GetFilter <MinMaxFilter>(); if (minMaxFilter != null) { var value = variable.Float; if (ImGui.SliderFloat(sliderLabel, ref value, minMaxFilter.Min ?? fallbackMin, minMaxFilter.Max ?? fallbackMax, displayText, 1)) { variable.Float = value; } } }
private void DrawIntSlider(IVariable variable, string sliderLabel, int fallbackMin, int fallbackMax, string displayText, Func <IVariable, int> getValue, Action <IVariable, int> setValue) { var minMaxFilter = variable.GetFilter <MinMaxFilter>(); if (minMaxFilter != null) { var value = getValue(variable); if (ImGui.SliderInt(sliderLabel, ref value, (int)(minMaxFilter.Min ?? fallbackMin), (int)(minMaxFilter.Max ?? fallbackMax), displayText)) { setValue(variable, value); } } }