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

Remove textrect attribute from textboxclass

Instead of duplicating the same variables over and over again,
Graphics::drawgui() can just make its own SDL_Rect. It's not that hard.

As far as I can tell, textrect was always being properly kept up to date
by the time Graphics::drawgui() got around to rendering
(textboxclass::resize() keeps being called a LOT), so this shouldn't be
a noticeable change from the user perspective.
This commit is contained in:
Misa 2021-03-19 19:47:37 -07:00 committed by Ethan Lee
parent 334302c800
commit 2ac13815e4
3 changed files with 2 additions and 10 deletions

View file

@ -855,8 +855,9 @@ void Graphics::drawgui(void)
} }
else else
{ {
SDL_Rect textrect = {textbox[i].xp, textbox[i].yp, textbox[i].w, textbox[i].h};
FillRect(backBuffer,textbox[i].textrect, textbox[i].r/6, textbox[i].g/6, textbox[i].b / 6 ); FillRect(backBuffer, textrect, textbox[i].r/6, textbox[i].g/6, textbox[i].b / 6 );
drawcoloredtile(textbox[i].xp, textbox[i].yp, 40, textbox[i].r, textbox[i].g, textbox[i].b); drawcoloredtile(textbox[i].xp, textbox[i].yp, 40, textbox[i].r, textbox[i].g, textbox[i].b);
drawcoloredtile(textbox[i].xp+textbox[i].w-8, textbox[i].yp, 42, textbox[i].r, textbox[i].g, textbox[i].b); drawcoloredtile(textbox[i].xp+textbox[i].w-8, textbox[i].yp, 42, textbox[i].r, textbox[i].g, textbox[i].b);

View file

@ -21,10 +21,6 @@ textboxclass::textboxclass(void)
tg = 0; tg = 0;
tb = 0; tb = 0;
max = 0; max = 0;
textrect.x = 0;
textrect.y = 0;
textrect.w = 0;
textrect.h = 0;
} }
void textboxclass::centerx(void) void textboxclass::centerx(void)
@ -121,10 +117,6 @@ void textboxclass::resize(void)
lw = max; lw = max;
w = (max +2) * 8; w = (max +2) * 8;
h = (line.size() + 2) * 8; h = (line.size() + 2) * 8;
textrect.x = xp;
textrect.y = yp;
textrect.w = w;
textrect.h = h;
} }
void textboxclass::addline(std::string t) void textboxclass::addline(std::string t)

View file

@ -35,7 +35,6 @@ public:
int xp, yp, lw, w, h; int xp, yp, lw, w, h;
int r,g,b; int r,g,b;
int tr,tg,tb; int tr,tg,tb;
SDL_Rect textrect;
int timer; int timer;
float tl; float tl;