Closed sleepyandinsane closed 7 months ago
also it works fine when using ImGui.SliderFloat
try:
CustomWidgets.CustomStyledSlider("ParryRecovery##Slider1", ref ParryRecoveryTime, 0.0f, 1f, 200); CustomWidgets.CustomStyledSlider("RiposteWindow##Slider2", ref RiposteWindowTime, 0.0f, 1f, 200);
hey, sadly the issue still persists D:
heres my customwidget code:
public static bool CustomStyledSlider(string label, ref float value, float min, float max, float sliderWidth, string format = "%.3f", float power = 1.0f) { bool valueChanged = false;
// Custom styling
ImGui.PushStyleColor(ImGuiCol.FrameBg, new Vector4(0.1f, 0.1f, 0.1f, 1.0f));
ImGui.PushStyleColor(ImGuiCol.FrameBgHovered, new Vector4(0.2f, 0.2f, 0.2f, 1.0f));
ImGui.PushStyleColor(ImGuiCol.FrameBgActive, new Vector4(0.3f, 0.3f, 0.3f, 1.0f));
ImGui.PushStyleColor(ImGuiCol.SliderGrab, new Vector4(0.5f, 0.5f, 1.0f, 1.0f));
ImGui.PushStyleColor(ImGuiCol.SliderGrabActive, new Vector4(0.7f, 0.7f, 1.0f, 1.0f));
ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(0.8f, 0.8f, 0.8f, 1.0f));
ImGui.PushStyleColor(ImGuiCol.TextDisabled, new Vector4(0.5f, 0.5f, 0.5f, 1.0f));
ImGui.PushStyleColor(ImGuiCol.Border, new Vector4(0.5f, 0.5f, 0.5f, 1.0f));
ImGui.PushStyleVar(ImGuiStyleVar.FrameBorderSize, 1.0f);
ImGui.PushStyleVar(ImGuiStyleVar.FrameRounding, 6.0f);
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(8, 4));
ImGui.PushStyleVar(ImGuiStyleVar.GrabMinSize, 20);
ImGui.PushItemWidth(sliderWidth);
valueChanged |= ImGui.SliderFloat("##Slider", ref value, min, max, format);
ImGui.PopStyleColor(8);
ImGui.PopStyleVar(5);
return valueChanged;
}
fixed by modifying to this, thanks:
valueChanged |= ImGui.SliderFloat("##Slider_" + label, ref value, min, max, format);
hi, i made a custom slider for use in my program, but even when using different labels they affect eachother.
CustomWidgets.CustomStyledSlider("ParryRecovery##Slider", ref ParryRecoveryTime, 0.0f, 1f, 200); CustomWidgets.CustomStyledSlider("RiposteWindow##Slider", ref RiposteWindowTime, 0.0f, 1f, 200);
even if i make a new widget, (e.g CustomSlider2), the values are still shared.
the references are different too