From 33659e55347347973b900bf1f13776548ae24431 Mon Sep 17 00:00:00 2001 From: Noderyos Date: Fri, 11 Sep 2026 18:44:34 +0200 Subject: [PATCH] Fix text spacing and pos in 2D --- src/main.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 4b3c080..a39d64a 100644 --- a/src/main.c +++ b/src/main.c @@ -1439,6 +1439,7 @@ int main(void) float m_size_2d = 24.0f * cfg.ui_scale / Camera2DParams.zoom; float m_text_2d = 16.0f * cfg.ui_scale / Camera2DParams.zoom; + float m_spacing_2d = cfg.ui_scale / Camera2DParams.zoom; float mark_size_2d = 32.0f * cfg.ui_scale / Camera2DParams.zoom; /* 2d projection rendering */ @@ -1634,7 +1635,7 @@ int main(void) if (is_hl && Camera2DParams.zoom > 0.1f) { - DrawUIText(customFont, satellites[i].name, sat_mx + (offset_i * map_w) + (m_size_2d / 2.f) + 4.f, sat_my - (m_size_2d / 2.f), m_text_2d, sCol); + DrawTextEx(customFont, satellites[i].name, (Vector2){sat_mx + (offset_i * map_w) + (m_size_2d / 2.f) + 4.f / Camera2DParams.zoom, sat_my - (m_size_2d / 2.f)}, m_text_2d, m_spacing_2d, sCol); } } } @@ -1652,7 +1653,7 @@ int main(void) if (Camera2DParams.zoom > 0.1f) { - DrawUIText(customFont, home_location.name, hx + x_off + (m_size_2d / 2.f) + 4.f, hy - (m_size_2d / 2.f), m_text_2d, WHITE); + DrawTextEx(customFont, home_location.name, (Vector2){hx + x_off + (m_size_2d / 2.f) + 4.0f / Camera2DParams.zoom, hy - (m_size_2d / 2.f)}, m_text_2d, m_spacing_2d, WHITE); } } @@ -1681,13 +1682,13 @@ int main(void) Vector2 mid = {(p1.x + p2.x) / 2.0f, (p1.y + p2.y) / 2.0f}; char rng_str[32]; TextCopy(rng_str, TextFormat("%.1f km", range)); - Vector2 tSize = MeasureTextEx(customFont, rng_str, m_text_2d, 1.0f); + Vector2 tSize = MeasureTextEx(customFont, rng_str, m_text_2d, m_spacing_2d); DrawRectangle( mid.x - tSize.x / 2.0f - 2.0f / Camera2DParams.zoom, mid.y - tSize.y / 2.0f - 2.0f / Camera2DParams.zoom, tSize.x + 4.0f / Camera2DParams.zoom, tSize.y + 4.0f / Camera2DParams.zoom, ApplyAlpha(cfg.ui_bg, 0.7f) ); - DrawUIText(customFont, rng_str, mid.x - tSize.x / 2.0f, mid.y - tSize.y / 2.0f, m_text_2d, cfg.ui_accent); + DrawTextEx(customFont, rng_str, (Vector2){mid.x - tSize.x / 2.0f, mid.y - tSize.y / 2.0f}, m_text_2d, m_spacing_2d, cfg.ui_accent); } } } @@ -1708,7 +1709,7 @@ int main(void) if (Camera2DParams.zoom > 0.1f) { - DrawUIText(customFont, markers[m].name, mx + x_off + (m_size_2d / 2.f) + 4.f, my - (m_size_2d / 2.f), m_text_2d, WHITE); + DrawTextEx(customFont, markers[m].name, (Vector2){mx + x_off + (m_size_2d / 2.f) + 4.f / Camera2DParams.zoom, my - (m_size_2d / 2.f)}, m_text_2d, m_spacing_2d, WHITE); } } }