From bf85e10219664624f9de60dcce238fcb56d89ce9 Mon Sep 17 00:00:00 2001 From: Dav999 Date: Fri, 8 Dec 2023 23:18:58 +0100 Subject: [PATCH] Try to prevent some lines in rolling credits going offscreen The new localization-related credits are placed 5 characters from the left border in the rolling credits (at x=40), which means the limit was 35 8x8 characters. Which was broken by several languages. So instead, move the string leftward a bit if it would run offscreen otherwise. --- desktop_version/src/Render.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index 207240e1..de2f568b 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -1987,25 +1987,34 @@ void gamecompleterender(void) if (graphics.onscreen(creditOffset + position)) { - font::print(PR_2X | PR_CEN, -1, creditOffset + position, loc::gettext("Localisation"), tr, tg, tb); + font::print(PR_2X | PR_CJK_HIGH | PR_CEN, -1, creditOffset + position, loc::gettext("Localisation"), tr, tg, tb); } creditOffset += 30; if (graphics.onscreen(creditOffset + position)) { - font::print(PR_CJK_HIGH, 40, creditOffset + position, loc::gettext("Localisation Project Led by"), tr, tg, tb); + const char* text = loc::gettext("Localisation Project Led by"); + int x = SCREEN_WIDTH_PIXELS - font::len(0, text); + x = SDL_min(x, 40); + font::print(PR_CJK_HIGH, x, creditOffset + position, text, tr, tg, tb); font::print(PR_2X | PR_FONT_8X8, 60, creditOffset + position + 10, "Dav999", tr, tg, tb); } creditOffset += 40; if (graphics.onscreen(creditOffset + position)) { - font::print(PR_CJK_HIGH, 40, creditOffset + position, loc::gettext("Pan-European Font Design by"), tr, tg, tb); + const char* text = loc::gettext("Pan-European Font Design by"); + int x = SCREEN_WIDTH_PIXELS - font::len(0, text); + x = SDL_min(x, 40); + font::print(PR_CJK_HIGH, x, creditOffset + position, text, tr, tg, tb); font::print(PR_2X | PR_FONT_8X8, 60, creditOffset + position + 10, "Reese Rivers", tr, tg, tb); } creditOffset += 40; if (graphics.onscreen(creditOffset + position)) { - font::print(PR_CJK_HIGH, 40, creditOffset + position, loc::gettext("With contributions on GitHub from"), tr, tg, tb); + const char* text = loc::gettext("With contributions on GitHub from"); + int x = SCREEN_WIDTH_PIXELS - font::len(0, text); + x = SDL_min(x, 40); + font::print(PR_CJK_HIGH, x, creditOffset + position, text, tr, tg, tb); font::print(PR_2X | PR_FONT_8X8, 60, creditOffset + position + 10, "Alexandra Fox", tr, tg, tb); font::print(PR_2X | PR_FONT_8X8, 60, creditOffset + position + 30, "mothbeanie", tr, tg, tb); }