1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-28 23:48:30 +02:00

Complete font::print_wrap flag handling

Also added some borders to more of the text in room name translator
mode, fixed a positioning issue if the interface font is not 8x8, and
migrated the trophy texts to font::print_wrap (including
PR_COLORGLYPH_BRI that still needed to be done)
This commit is contained in:
Dav999-v 2023-01-14 05:16:00 +01:00 committed by Misa Elizabeth Kai
parent 689d6e3e97
commit dadb7f2623
3 changed files with 17 additions and 9 deletions

View File

@ -901,7 +901,7 @@ void print(
} }
int print_wrap( int print_wrap(
const uint32_t flags, uint32_t flags,
const int x, const int x,
int y, int y,
const std::string& text, const std::string& text,
@ -912,18 +912,28 @@ int print_wrap(
int maxwidth /*= -1*/ int maxwidth /*= -1*/
) )
{ {
PrintFlags pf = decode_print_flags(flags);
if (pf.font_sel == NULL)
{
return y;
}
if (linespacing == -1) if (linespacing == -1)
{ {
linespacing = 10; linespacing = 10;
} }
linespacing = SDL_max(linespacing, loc::get_langmeta()->font_h); linespacing = SDL_max(linespacing, pf.font_sel->glyph_h * pf.scale);
if (maxwidth == -1) if (maxwidth == -1)
{ {
maxwidth = 304; maxwidth = 304;
} }
// TODO look through all the flags if (pf.border && !graphics.notextoutline && (r|g|b) != 0)
{
print_wrap(flags, x, y, text, 0, 0, 0, linespacing, maxwidth);
flags &= ~PR_BOR;
}
const char* str = text.c_str(); const char* str = text.c_str();
// This could fit 64 non-BMP characters onscreen, should be plenty // This could fit 64 non-BMP characters onscreen, should be plenty

View File

@ -1827,18 +1827,16 @@ void Graphics::drawtrophytext(void)
break; break;
} }
/* These were `bprint` before */
// TODO: add PR_COLORGLYPH_BRI(brightness) | PR_BOR
short lines; short lines;
if (top_text != NULL) if (top_text != NULL)
{ {
font::string_wordwrap(top_text, 304, &lines); font::string_wordwrap(top_text, 304, &lines);
PrintWrap(-1, 11-(lines-1)*5, top_text, temp, temp2, temp3, true); font::print_wrap(PR_CEN | PR_COLORGLYPH_BRI(brightness) | PR_BOR, -1, 11-(lines-1)*5, top_text, temp, temp2, temp3);
} }
if (bottom_text != NULL) if (bottom_text != NULL)
{ {
font::string_wordwrap(bottom_text, 304, &lines); font::string_wordwrap(bottom_text, 304, &lines);
PrintWrap(-1, 221-(lines-1)*5, bottom_text, temp, temp2, temp3, true); font::print_wrap(PR_CEN | PR_COLORGLYPH_BRI(brightness) | PR_BOR, -1, 221-(lines-1)*5, bottom_text, temp, temp2, temp3);
} }
} }

View File

@ -75,7 +75,7 @@ namespace roomname_translator
const char* first_part = "Unexplained room names are "; const char* first_part = "Unexplained room names are ";
font::print(PR_BOR | PR_FONT_8X8, 0, 60, first_part, 255,255,255); font::print(PR_BOR | PR_FONT_8X8, 0, 60, first_part, 255,255,255);
font::print(PR_BOR | PR_FONT_8X8, graphics.len(first_part), 60, "cyan.", 64, 255, 255-help.glow); font::print(PR_BOR | PR_FONT_8X8, font::len(PR_FONT_8X8, first_part), 60, "cyan.", 64, 255, 255-help.glow);
} }
else else
{ {
@ -90,7 +90,7 @@ namespace roomname_translator
const char* first_part = "English room names are "; const char* first_part = "English room names are ";
font::print(PR_BOR | PR_FONT_8X8, 0, 60, first_part, 255,255,255); font::print(PR_BOR | PR_FONT_8X8, 0, 60, first_part, 255,255,255);
font::print(PR_BOR | PR_FONT_8X8, graphics.len(first_part), 60, "cyan.", 0, 192, 255-help.glow); font::print(PR_BOR | PR_FONT_8X8, font::len(PR_FONT_8X8, first_part), 60, "cyan.", 0, 192, 255-help.glow);
} }
font::print(PR_BOR | PR_FONT_8X8, 0, 80, "KEYS:", 255,255,255); font::print(PR_BOR | PR_FONT_8X8, 0, 80, "KEYS:", 255,255,255);
if (expl_mode) if (expl_mode)