Interpolate text box alpha

This makes text boxes fade in and out pretty smoothly.

This requires that the textboxclass::setcol() be in Graphics::drawgui(),
so now it's moved there.

Text box fading is only really noticeable if you're playing in slowmode.
This commit is contained in:
Misa
2020-04-28 21:49:15 -07:00
committed by Ethan Lee
parent 4ba9954eb8
commit c56df48d75
3 changed files with 7 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ textboxclass::textboxclass()
h = 0;
lw = 0;
tl = 0;
prev_tl = 0;
tm = 0;
timer = 0;
}
@@ -56,6 +57,7 @@ void textboxclass::setcol(int rr, int gg, int bb)
void textboxclass::update()
{
prev_tl = tl;
if (tm == 0)
{
tl += .1f;
@@ -64,7 +66,6 @@ void textboxclass::update()
tl = 1;
tm = 1;
}
setcol(int(tr * tl), int(tg * tl), int(tb * tl));
}
else if (tm == 2)
{
@@ -74,7 +75,6 @@ void textboxclass::update()
tl = 0.5;
//this textbox will be removed by updatetextboxes() later
}
setcol(int(tr * tl), int(tg * tl), int(tb * tl));
}
if (timer > 0)
{