We have made a hand-written version of the popular imgui-knobs library. To compile it, you need to add the imgui-knobs.h header to your header include path.
The cimgui-knobs.h header looks like this:
typedef enum ImGuiKnob_Flags_
{
CImGuiKnob_flags_None = 0,
CImGuiKnob_Flags_NoTitle = 1 << 0,
CImGuiKnob_Flags_NoInput = 1 << 1,
CImGuiKnob_Flags_ValueTooltip = 1 << 2,
CImGuiKnob_Flags_DragHorizontal = 1 << 3,
CImGuiKnob_Flags_DragVertical = 1 << 4,
CImGuiKnob_Flags_Logarithmic = 1 << 5,
CImGuiKnob_Flags_AlwaysClamp = 1 << 6
} ImGuiKnob_Flags_;
typedef enum ImGuiKnob_Variant_
{
CImGuiKnob_Variant_Tick = 1 << 0,
CImGuiKnob_Variant_Dot = 1 << 1,
CImGuiKnob_Variant_Wiper = 1 << 2,
CImGuiKnob_Variant_WiperOnly = 1 << 3,
CImGuiKnob_Variant_WiperDot = 1 << 4,
CImGuiKnob_Variant_Stepped = 1 << 5,
CImGuiKnob_Variant_Space = 1 << 6,
} ImGuiKnob_Variant_;
typedef struct ImGuiKnob_color_set_t
{
CImXVec4 base;
CImXVec4 hovered;
CImXVec4 active;
} ImGuiKnob_color_set;
bool ImGuiKnobs_Knob(const char* label, float* p_value, float v_min, float v_max);
bool ImGuiKnobs_KnobEx(const char* label, float* p_value, float v_min, float v_max, float speed, const char* format, ImGuiKnob_Variant variant, float size, ImGuiKnob_Flags flags, int steps, float angle_min, float angle_max);
bool ImGuiKnobs_KnobInt(const char* label, int* p_value, int v_min, int v_max);
bool ImGuiKnobs_KnobIntEx(const char* label, int* p_value, int v_min, int v_max, float speed, const char* format, ImGuiKnob_Variant variant, float size, ImGuiKnob_Flags flags, int steps, float angle_min, float angle_max);
As you can see, the major differences in the API between the C and C++ versions are:
- The
ImGuiKnobsnamespace is replaced by prefixing functions withImGuiKnobs_ - Default arguments are missing (can be seen as a comment in the header for reference)
- Enum members are prefixed with
Cto avoid compilation clashes with the regularimgui-knobslibrary