From c414be0087703588e388538892f495a60e3c81b8 Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Thu, 23 Jul 2026 22:58:14 +0200 Subject: [PATCH] Remove unused functions --- client/render/imgui_impl.cpp | 64 ------------------------------------ client/render/imgui_impl.h | 15 --------- 2 files changed, 79 deletions(-) diff --git a/client/render/imgui_impl.cpp b/client/render/imgui_impl.cpp index 7c772653..afaca6ef 100644 --- a/client/render/imgui_impl.cpp +++ b/client/render/imgui_impl.cpp @@ -1267,11 +1267,6 @@ void imgui_context::set_controllers_enabled(bool value) controllers_enabled = value; } -bool imgui_context::is_modal_popup_shown() const -{ - return ImGui::GetTopMostAndVisiblePopupModal() != nullptr; -} - imgui_context::viewport & imgui_context::layer(ImVec2 position) { for (auto & layer: layers_) @@ -1441,62 +1436,3 @@ void CenterTextHV(const std::string & text) } ImGui::PopStyleVar(); } - -void InputText(const char * label, std::string & text, const ImVec2 & size, ImGuiInputTextFlags flags) -{ - auto callback = [](ImGuiInputTextCallbackData * data) -> int { - std::string & text = *reinterpret_cast(data->UserData); - - if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) - { - assert(text.data() == data->Buf); - text.resize(data->BufTextLen); - data->Buf = text.data(); - } - - return 0; - }; - - ImGui::InputTextEx(label, nullptr, text.data(), text.size() + 1, size, flags | ImGuiInputTextFlags_CallbackResize, callback, &text); -} - -bool RadioButtonWithoutCheckBox(const std::string & label, bool active, ImVec2 size_arg) -{ - ImGuiWindow * window = ImGui::GetCurrentWindow(); - if (window->SkipItems) - return false; - - ImGuiContext & g = *GImGui; - const ImGuiStyle & style = g.Style; - const ImGuiID id = window->GetID(label.c_str()); - const ImVec2 label_size = ImGui::CalcTextSize(label.c_str(), NULL, true); - - const ImVec2 pos = window->DC.CursorPos; - - ImVec2 size = ImGui::CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f); - - const ImRect bb(pos, pos + size); - ImGui::ItemSize(bb, style.FramePadding.y); - if (!ImGui::ItemAdd(bb, id)) - return false; - - bool hovered, held; - bool pressed = ImGui::ButtonBehavior(bb, id, &hovered, &held); - - ImGuiCol_ col; - if ((held && hovered) || active) - col = ImGuiCol_ButtonActive; - else if (hovered) - col = ImGuiCol_ButtonHovered; - else - col = ImGuiCol_Button; - - ImGui::RenderNavHighlight(bb, id); - ImGui::RenderFrame(bb.Min, bb.Max, ImGui::GetColorU32(col), true, style.FrameRounding); - - ImVec2 TextAlign{0, 0.5f}; - ImGui::RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label.c_str(), NULL, &label_size, TextAlign, &bb); - - IMGUI_TEST_ENGINE_ITEM_INFO(id, label.c_str(), g.LastItemData.StatusFlags); - return pressed; -} diff --git a/client/render/imgui_impl.h b/client/render/imgui_impl.h index 978d22a8..5412cd18 100644 --- a/client/render/imgui_impl.h +++ b/client/render/imgui_impl.h @@ -249,8 +249,6 @@ public: void set_current(); - bool is_modal_popup_shown() const; - void vibrate_on_hover(); void set_hovered_item(); void set_controllers_enabled(bool value); @@ -267,16 +265,3 @@ void ScrollWhenDragging(); void CenterTextH(const std::string & text); void CenterTextHV(const std::string & text); - -void InputText(const char * label, std::string & text, const ImVec2 & size, ImGuiInputTextFlags flags); - -bool RadioButtonWithoutCheckBox(const std::string & label, bool active, ImVec2 size_arg); - -template -static bool RadioButtonWithoutCheckBox(const std::string & label, T & v, U v_button, ImVec2 size_arg) -{ - const bool pressed = RadioButtonWithoutCheckBox(label, v == v_button, size_arg); - if (pressed) - v = v_button; - return pressed; -}