1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-08 18:09:45 +01:00

PrintWrap: Account for height in Flip Mode

Otherwise, the text will be in the wrong position compared to normal
mode.

PrintWrap is not used in Flip Mode yet, but it will be used on the map
screen in an upcoming change of mine. The FLIP macro in Render.cpp can't
help us there, since it would need to know the height of the wrapped
text at compile time, when the height is only figured out at runtime
based off of the string (or, well, right _now_ the string _is_ known,
but we are going to merge localization for 2.4, and it's better to
future-proof...), and only PrintWrap itself can figure out the height of
the text. (Or, well, I suppose you could call it from outside the
function, but that's not very separation-of-concernsy style.)
This commit is contained in:
Misa 2021-10-01 20:47:31 -07:00
parent 517e20cecb
commit 98b392197c

View file

@ -652,6 +652,18 @@ void Graphics::PrintWrap(
char buffer[54*4 + 1];
size_t start = 0;
if (flipmode)
{
/* Correct for the height of the resulting print. */
size_t len = 0;
while (next_wrap(&start, &len, &str[start], maxwidth))
{
y += linespacing;
}
y -= linespacing;
start = 0;
}
while (next_wrap_s(buffer, sizeof(buffer), &start, str, maxwidth))
{
Print(x, y, buffer, r, g, b, cen);