15 const ImGuiStyle& style = ImGui::GetStyle();
17 ImVec4 hovered_color(
color.x +
color.x * hover_color_multiplier,
22 ImGui::PushStyleColor(ImGuiCol_Button,
color);
23 ImGui::PushStyleColor(ImGuiCol_ButtonHovered, hovered_color);
24 ImGui::PushStyleColor(ImGuiCol_ButtonActive,
color);
25 ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 0.0f);
26 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, style.ItemSpacing.y));
28 bool item_hovered =
false;
30 ImGui::Button(
"##bar_button", ImVec2(
width,
height));
31 item_hovered |= ImGui::IsItemHovered();
34 ImGui::InvisibleButton(
"##bar_invisible", ImVec2(max_width -
width + 1,
height));
35 item_hovered |= ImGui::IsItemHovered();
37 ImGui::PopStyleVar(2);
38 ImGui::PopStyleColor(3);
45 uint32_t current_value,
50 bool item_hovered =
false;
53 ImGui::AlignTextToFramePadding();
54 ImGui::Text(
"%s: %6d / %6d",
name, current_value, max_value);
55 item_hovered |= ImGui::IsItemHovered();
58 const float percentage =
static_cast<float>(current_value) /
static_cast<float>(max_value);
59 static const ImVec4
color(0.5f, 0.5f, 0.5f, 1.0f);
63 ImGui::Text(
"%5.2f%%",
static_cast<double>(percentage * 100.0f));
67 ImGui::SetNextWindowViewportToCurrent();
68 ImGui::BeginTooltip();
69 ImGui::Text(
"%s %5.2f%%",
tooltip,
static_cast<double>(percentage * 100.0f));