17 ImGuiWindow* window = ImGui::GetCurrentWindow();
18 if (window->SkipItems)
23 ImGuiContext& g = *GImGui;
24 const ImGuiStyle& style = g.Style;
25 const ImGuiID
id = window->GetID(label);
27 ImVec2 pos = window->DC.CursorPos;
28 ImVec2 size((radius) * 2 + style.FramePadding.x, (radius + style.FramePadding.y) * 2);
30 const ImRect bb(pos, ImVec2(pos.x + size.x, pos.y + size.y));
31 ImGui::ItemSize(bb, style.FramePadding.y);
32 if (!ImGui::ItemAdd(bb,
id))
38 window->DrawList->PathClear();
40 int num_segments = 30;
41 int start =
static_cast<int>(std::abs(std::sin(g.Time * 1.8) * (num_segments - 5)));
43 const float a_min = IM_PI * 2.0F *
static_cast<float>(start) /
static_cast<float>(num_segments);
44 const float a_max = IM_PI * 2.0F *
static_cast<float>(num_segments - 3) /
static_cast<float>(num_segments);
46 const ImVec2 centre = ImVec2(pos.x + radius, pos.y + radius + style.FramePadding.y);
48 for (
int i = 0; i < num_segments; i++)
50 const float a = a_min + (
static_cast<float>(i) /
static_cast<float>(num_segments)) * (a_max - a_min);
51 window->DrawList->PathLineTo(ImVec2(centre.x + ImCos(a +
static_cast<float>(g.Time) * 8) * radius,
52 centre.y + ImSin(a +
static_cast<float>(g.Time) * 8) * radius));
55 window->DrawList->PathStroke(color,
false, thickness);