7 {
8 ImGuiWindow* window = GetCurrentWindow();
9 if (window->SkipItems)
10 return false;
11
12 ImGuiContext& g = *GImGui;
13 const ImGuiStyle& style = g.Style;
14 const ImGuiID id = window->GetID(label);
15
16 ImVec2 pos = window->DC.CursorPos;
17 ImVec2 size = size_arg;
18 size.x -= style.FramePadding.x * 2.0f;
19
20 const ImRect bb(pos, ImVec2(pos.x + size.x, pos.y + size.y));
21 ItemSize(bb, style.FramePadding.y);
22 if (!ItemAdd(bb, id))
23 return false;
24
25
26 const float circleStart = size.x * 0.7f;
27 const float circleEnd = size.x;
28 const float circleWidth = circleEnd - circleStart;
29
30 window->DrawList->AddRectFilled(bb.Min, ImVec2(pos.x + circleStart, bb.Max.y), bg_col);
31 window->DrawList->AddRectFilled(bb.Min, ImVec2(pos.x + circleStart*value, bb.Max.y), fg_col);
32
33 const float t = (float) g.Time;
34 const float r = size.y / 2.0f;
35 const float speed = 1.5f;
36
37 const float a = speed*0;
38 const float b = speed*0.333f;
39 const float c = speed*0.666f;
40
41 const float o1 = (circleWidth+r) * (t+a - speed * (int)((t+a) / speed)) / speed;
42 const float o2 = (circleWidth+r) * (t+b - speed * (int)((t+b) / speed)) / speed;
43 const float o3 = (circleWidth+r) * (t+c - speed * (int)((t+c) / speed)) / speed;
44
45 window->DrawList->AddCircleFilled(ImVec2(pos.x + circleEnd - o1, bb.Min.y + r), r, bg_col);
46 window->DrawList->AddCircleFilled(ImVec2(pos.x + circleEnd - o2, bb.Min.y + r), r, bg_col);
47 window->DrawList->AddCircleFilled(ImVec2(pos.x + circleEnd - o3, bb.Min.y + r), r, bg_col);
48 return true;
49 }