1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 10:09:43 +01:00

Simplify flipme text box position correction

It now looks more like the FLIP macro in Render.cpp: The y-position is
simply the height of the area the object is being flipped in, minus the
y-position itself, minus the height of the object. So:

    flipped_yp = constant - yp - height

This is just a mathematical simplification of the existing statement,
which is:

    flipped_yp = yp + 2 * (constant/2 - yp) - height

Using algebra, the 2 distributes into the parentheses, so

    flipped_yp = yp + constant - 2 * yp - height

And the two `yp`s add together, so

    flipped_yp = constant - yp - height

It's more readable this way.

Also I am using a named constant instead of a hardcoded one.
This commit is contained in:
Misa 2021-10-01 20:59:55 -07:00
parent 98b392197c
commit b26ccd914d

View file

@ -990,7 +990,7 @@ void Graphics::drawgui(void)
yp = textboxes[i].yp; yp = textboxes[i].yp;
if (flipmode && textboxes[i].flipme) if (flipmode && textboxes[i].flipme)
{ {
yp += 2 * (120 - yp) - 8 * (textboxes[i].lines.size() + 2); yp = SCREEN_HEIGHT_PIXELS - yp - 8 * (textboxes[i].lines.size() + 2);
} }
if (textboxes[i].r == 0 && textboxes[i].g == 0 && textboxes[i].b == 0) if (textboxes[i].r == 0 && textboxes[i].g == 0 && textboxes[i].b == 0)