summaryrefslogtreecommitdiffstats
path: root/game/client/gui/status_lines.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-09-11 15:10:18 +0500
committeruntodesu <kirill@untode.su>2025-09-11 15:10:18 +0500
commita6ea7b7bbc66327cc2a957496f65dcfab5361cee (patch)
treea4fda8a1a490bf1d88afe4e8d2f8814afdcc0de1 /game/client/gui/status_lines.cc
parent8784cbfebcb8a0220fb947a6070032e20b80fc2f (diff)
downloadvoxelius-a6ea7b7bbc66327cc2a957496f65dcfab5361cee.tar.bz2
voxelius-a6ea7b7bbc66327cc2a957496f65dcfab5361cee.zip
Update ImGui to a newer version with font scaling
Diffstat (limited to 'game/client/gui/status_lines.cc')
-rw-r--r--game/client/gui/status_lines.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/game/client/gui/status_lines.cc b/game/client/gui/status_lines.cc
index 054f971..9d9ac4c 100644
--- a/game/client/gui/status_lines.cc
+++ b/game/client/gui/status_lines.cc
@@ -8,6 +8,7 @@
static float line_offsets[gui::STATUS_COUNT];
static ImFont* line_fonts[gui::STATUS_COUNT];
+static float line_sizes[gui::STATUS_COUNT];
static ImVec4 line_text_colors[gui::STATUS_COUNT];
static ImVec4 line_shadow_colors[gui::STATUS_COUNT];
@@ -34,8 +35,11 @@ void gui::status_lines::init_late(void)
void gui::status_lines::layout(void)
{
- line_fonts[STATUS_DEBUG] = globals::font_debug;
- line_fonts[STATUS_HOTBAR] = globals::font_chat;
+ line_fonts[STATUS_DEBUG] = globals::font_unscii8;
+ line_sizes[STATUS_DEBUG] = 4.0f;
+
+ line_fonts[STATUS_HOTBAR] = globals::font_unscii16;
+ line_sizes[STATUS_HOTBAR] = 8.0f;
auto viewport = ImGui::GetMainViewport();
auto draw_list = ImGui::GetForegroundDrawList();
@@ -45,7 +49,7 @@ void gui::status_lines::layout(void)
auto& text = line_strings[i];
auto* font = line_fonts[i];
- auto size = font->CalcTextSizeA(font->FontSize, FLT_MAX, 0.0f, text.c_str(), text.c_str() + text.size());
+ auto size = font->CalcTextSizeA(line_sizes[i] * globals::gui_scale, FLT_MAX, 0.0f, text.c_str(), text.c_str() + text.size());
auto pos = ImVec2(0.5f * (viewport->Size.x - size.x), viewport->Size.y - offset);
auto spawn = line_spawns[i];
@@ -57,7 +61,7 @@ void gui::status_lines::layout(void)
auto color_U32 = ImGui::GetColorU32(ImVec4(color.x, color.y, color.z, color.w * alpha));
auto shadow_U32 = ImGui::GetColorU32(ImVec4(shadow.x, shadow.y, shadow.z, color.w * alpha));
- gui::imdraw_ext::text_shadow(text, pos, color_U32, shadow_U32, font, draw_list);
+ gui::imdraw_ext::text_shadow(text, pos, color_U32, shadow_U32, font, draw_list, line_sizes[i]);
}
}