A rotating three-quarter arc, animated off ImGui::GetTime().
| 23 | |
| 24 | // A rotating three-quarter arc, animated off ImGui::GetTime(). |
| 25 | void DrawSpinner(float Radius, float Thickness, ImU32 Color) |
| 26 | { |
| 27 | const ImVec2 TopLeft = ImGui::GetCursorScreenPos(); |
| 28 | const ImVec2 Center = ImVec2(TopLeft.x + Radius, TopLeft.y + Radius); |
| 29 | |
| 30 | ImDrawList* DrawList = ImGui::GetWindowDrawList(); |
| 31 | constexpr int Segments = 32; |
| 32 | const float Time = static_cast<float>(ImGui::GetTime()); |
| 33 | const float Start = Time * 5.0f; |
| 34 | const float ArcSpan = IM_PI * 1.5f; |
| 35 | |
| 36 | DrawList->PathClear(); |
| 37 | for (int i = 0; i <= Segments; ++i) |
| 38 | { |
| 39 | const float Angle = Start + (static_cast<float>(i) / Segments) * ArcSpan; |
| 40 | DrawList->PathLineTo(ImVec2(Center.x + std::cos(Angle) * Radius, |
| 41 | Center.y + std::sin(Angle) * Radius)); |
| 42 | } |
| 43 | DrawList->PathStroke(Color, Thickness, ImDrawFlags_None); |
| 44 | |
| 45 | ImGui::Dummy(ImVec2(Radius * 2.0f, Radius * 2.0f)); |
| 46 | } |
| 47 | |
| 48 | void DrawTask(const FSlowTaskProgress& Task) |
| 49 | { |
no test coverage detected