| 80 | }; |
| 81 | |
| 82 | void drawBar(float fraction, const ImVec2& size, ImU32 color = 0xffffffff, ImU32 background = 0x00000000, bool highlight = false) |
| 83 | { |
| 84 | auto cursorPos = ImGui::GetCursorScreenPos(); |
| 85 | auto height = ImGui::GetTextLineHeightWithSpacing(); |
| 86 | cursorPos.y += 0.5f * (height - size.y); |
| 87 | ImGui::GetWindowDrawList()->AddRectFilled( |
| 88 | ImVec2(cursorPos.x, cursorPos.y), ImVec2(cursorPos.x + size.x, cursorPos.y + size.y), background |
| 89 | ); |
| 90 | ImGui::GetWindowDrawList()->AddRectFilled( |
| 91 | ImVec2(cursorPos.x, cursorPos.y), ImVec2(cursorPos.x + fraction * size.x, cursorPos.y + size.y), color |
| 92 | ); |
| 93 | if (highlight) |
| 94 | ImGui::GetWindowDrawList()->AddRect( |
| 95 | ImVec2(cursorPos.x, cursorPos.y), ImVec2(cursorPos.x + size.x, cursorPos.y + size.y), kHighlightColor |
| 96 | ); |
| 97 | } |
| 98 | } // namespace |
| 99 | |
| 100 | void ProfilerUI::render() |