mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 09:28:15 +03: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:
@@ -990,7 +990,7 @@ void Graphics::drawgui(void)
|
||||
yp = textboxes[i].yp;
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user