1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Allow multiple lines and wordwrapping in activity zone prompts

Activity zone prompts have always been limited to a single line,
because the text box had a hardcoded size. A translator requested for
the possibility to add a subtitle under music names for the jukebox,
and the easiest solution is to make it possible to translate a prompt
with multiple lines. This is possible now, and the textbox even
wordwraps automatically.

(I wouldn't really like to see translations using multiple lines for
stuff like "Press ENTER to talk to Vitellary", especially if it wraps
with one name and not with another, but if a string is too long,
wordwrapping will look better than text running out of the box.)
This commit is contained in:
Dav999-v 2023-02-21 03:26:16 +01:00 committed by Misa Elizabeth Kai
parent a320ee3b4d
commit 086b157152

View file

@ -2223,6 +2223,7 @@ void gamerender(void)
);
uint8_t text_r, text_g, text_b;
uint32_t text_flags = game.activity_print_flags | PR_BRIGHTNESS(act_alpha*255) | PR_CJK_LOW | PR_CEN;
if (game.activity_r == 0 && game.activity_g == 0 && game.activity_b == 0)
{
@ -2232,11 +2233,14 @@ void gamerender(void)
}
else
{
short lines;
font::string_wordwrap(text_flags, final_string, 37*8, &lines);
graphics.drawpixeltextbox(
4,
game.activity_y + 4,
39*8,
16 + font::height(game.activity_print_flags),
16 + font::height(text_flags)*lines,
game.activity_r*act_alpha,
game.activity_g*act_alpha,
game.activity_b*act_alpha
@ -2247,14 +2251,16 @@ void gamerender(void)
text_b = game.activity_b;
}
font::print(
game.activity_print_flags | PR_BRIGHTNESS(act_alpha*255) | PR_CJK_LOW | PR_CEN,
font::print_wrap(
text_flags,
-1,
game.activity_y + 12,
final_string,
text_r,
text_g,
text_b
text_b,
8,
37*8
);
}