From a6ea7b7bbc66327cc2a957496f65dcfab5361cee Mon Sep 17 00:00:00 2001 From: untodesu Date: Thu, 11 Sep 2025 15:10:18 +0500 Subject: Update ImGui to a newer version with font scaling --- game/client/gui/scoreboard.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'game/client/gui/scoreboard.cc') diff --git a/game/client/gui/scoreboard.cc b/game/client/gui/scoreboard.cc index 85a982f..ad49a69 100644 --- a/game/client/gui/scoreboard.cc +++ b/game/client/gui/scoreboard.cc @@ -51,11 +51,11 @@ void gui::scoreboard::layout(void) return; } - ImGui::PushFont(globals::font_chat); + ImGui::PushFont(globals::font_unscii16, 8.0f); const auto& padding = ImGui::GetStyle().FramePadding; const auto& spacing = ImGui::GetStyle().ItemSpacing; - auto font = globals::font_chat; + auto font = globals::font_unscii8; // Figure out the maximum username size for(const auto& username : usernames) { @@ -74,7 +74,7 @@ void gui::scoreboard::layout(void) const float rect_start_x = 0.5f * window_size.x - 0.5f * true_size; const float rect_start_y = 0.15f * window_size.y; const float rect_size_x = 2.0f * padding.x + true_size; - const float rect_size_y = 2.0f * padding.y + font->FontSize; + const float rect_size_y = 2.0f * padding.y + 0.5f * ImGui::GetFontSize(); // const ImU32 border_col = ImGui::GetColorU32(ImGuiCol_Border, 1.00f); const ImU32 rect_col = ImGui::GetColorU32(ImGuiCol_FrameBg, 0.80f); @@ -92,7 +92,8 @@ void gui::scoreboard::layout(void) // draw_list->AddRect(rect_a, rect_b, border_col, 0.0f, ImDrawFlags_None, globals::gui_scale); draw_list->AddRectFilled(rect_a, rect_b, rect_col, 0.0f, ImDrawFlags_None); - draw_list->AddText(font, font->FontSize, text_pos, text_col, usernames[i].c_str(), usernames[i].c_str() + usernames[i].size()); + draw_list->AddText( + font, 0.5f * ImGui::GetFontSize(), text_pos, text_col, usernames[i].c_str(), usernames[i].c_str() + usernames[i].size()); } ImGui::PopFont(); -- cgit