mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Make wordwrapping functions take font arguments
They need to know how wide the text is going to be in a particular font, so font::string_wordwrap and font::string_wordwrap_balanced now take a flags argument like all the printing and dimensions-getting functions. next_wrap and next_wrap_s take a Font* now, they're internal to Font.cpp so they can take a Font and avoid double flag-parsing. But if any non-Font.cpp code needs next_wrap/next_wrap_s in the future, I'd just make a public wrapper that takes a uint32_t flags and passes the Font* to the internal functions.
This commit is contained in:
committed by
Misa Elizabeth Kai
parent
0eaceed0a2
commit
25feb9dbb5
@@ -1770,12 +1770,12 @@ void Graphics::drawtrophytext(void)
|
||||
short lines;
|
||||
if (top_text != NULL)
|
||||
{
|
||||
font::string_wordwrap(top_text, 304, &lines);
|
||||
font::string_wordwrap(0, top_text, 304, &lines);
|
||||
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)
|
||||
{
|
||||
font::string_wordwrap(bottom_text, 304, &lines);
|
||||
font::string_wordwrap(0, bottom_text, 304, &lines);
|
||||
font::print_wrap(PR_CEN | PR_COLORGLYPH_BRI(brightness) | PR_BOR, -1, 221-(lines-1)*5, bottom_text, temp, temp2, temp3);
|
||||
}
|
||||
}
|
||||
@@ -3049,7 +3049,11 @@ int Graphics::textboxwrap(int pad)
|
||||
vlog_error("textboxwrap() has no first line!");
|
||||
return 16;
|
||||
}
|
||||
std::string wrapped = font::string_wordwrap_balanced(textboxes[m].lines[0], 36*8 - pad*8);
|
||||
std::string wrapped = font::string_wordwrap_balanced(
|
||||
textboxes[m].print_flags,
|
||||
textboxes[m].lines[0],
|
||||
36*8 - pad*8
|
||||
);
|
||||
textboxes[m].lines.clear();
|
||||
|
||||
size_t startline = 0;
|
||||
|
||||
Reference in New Issue
Block a user