forked from altschuler/imgui-knobs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimgui-knobs.h
51 lines (40 loc) · 1.67 KB
/
imgui-knobs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#pragma once
#include <cstdlib>
#define IMGUI_DEFINE_MATH_OPERATORS
#include <imgui.h>
typedef int ImGuiKnobFlags;
enum ImGuiKnobFlags_ {
ImGuiKnobFlags_NoTitle = 1 << 0,
ImGuiKnobFlags_NoInput = 1 << 1,
ImGuiKnobFlags_ValueTooltip = 1 << 2,
ImGuiKnobFlags_DragHorizontal = 1 << 3,
ImGuiKnobFlags_RotateRelative = 1 << 4,
ImGuiKnobFlags_RotateAbsolute = 1 << 5,
ImGuiKnobFlags_WrapAround = 1 << 6,
};
typedef int ImGuiKnobVariant;
enum ImGuiKnobVariant_ {
ImGuiKnobVariant_Tick = 1 << 0,
ImGuiKnobVariant_Dot = 1 << 1,
ImGuiKnobVariant_Wiper = 1 << 2,
ImGuiKnobVariant_WiperOnly = 1 << 3,
ImGuiKnobVariant_WiperDot = 1 << 4,
ImGuiKnobVariant_Stepped = 1 << 5,
ImGuiKnobVariant_Space = 1 << 6,
};
namespace ImGuiKnobs {
struct color_set {
ImColor base;
ImColor hovered;
ImColor active;
color_set(ImColor base, ImColor hovered, ImColor active) : base(base), hovered(hovered), active(active) {}
color_set(ImColor color) {
base = color;
hovered = color;
active = color;
}
};
bool Knob(const char *label, float *p_value, float v_min, float v_max, float speed = 0, const char *format = NULL, ImGuiKnobVariant variant = ImGuiKnobVariant_Tick, float size = 0, ImGuiKnobFlags flags = 0, int steps = 10
,float aAngleMin=3.14159265358979323846f*0.75f,float aAngleMax=3.14159265358979323846f*2.25f);
bool KnobInt(const char *label, int *p_value, int v_min, int v_max, float speed = 0, const char *format = NULL, ImGuiKnobVariant variant = ImGuiKnobVariant_Tick, float size = 0, ImGuiKnobFlags flags = 0, int steps = 10);
}// namespace ImGuiKnobs