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.
This commit is contained in:
Dav999 2023-12-08 23:18:58 +01:00 committed by Misa Elizabeth Kai
parent c1fea5f55a
commit bf85e10219
1 changed files with 13 additions and 4 deletions

View File

@ -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);
}