mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 22:25:38 +00:00
Fixed two text color issues when resetting ScrollableContainer.
This commit is contained in:
parent
0e9e47e090
commit
2bf5e6f3f1
|
@ -165,8 +165,14 @@ void ScrollableContainer::update(int deltaTime)
|
||||||
mAutoScrollResetAccumulator += deltaTime;
|
mAutoScrollResetAccumulator += deltaTime;
|
||||||
if (mAutoScrollResetAccumulator >= static_cast<int>(mAutoScrollResetDelayConstant)) {
|
if (mAutoScrollResetAccumulator >= static_cast<int>(mAutoScrollResetDelayConstant)) {
|
||||||
// Fade in the text as it resets to the start position.
|
// Fade in the text as it resets to the start position.
|
||||||
auto func = [this](float t) {
|
float maxOpacity {static_cast<float>(mChildren.front()->getColor() & 0x000000FF) /
|
||||||
this->setOpacity(static_cast<unsigned char>(glm::mix(0.0f, 1.0f, t) * 255));
|
255.0f};
|
||||||
|
auto func = [this, maxOpacity](float t) {
|
||||||
|
unsigned int color {mChildren.front()->getColor()};
|
||||||
|
unsigned int opacity {
|
||||||
|
static_cast<unsigned int>(glm::mix(0.0f, maxOpacity, t) * 255)};
|
||||||
|
color = (color & 0xFFFFFF00) + opacity;
|
||||||
|
this->mChildren.front()->setColor(color);
|
||||||
mScrollPos = glm::vec2 {};
|
mScrollPos = glm::vec2 {};
|
||||||
mAutoScrollResetAccumulator = 0;
|
mAutoScrollResetAccumulator = 0;
|
||||||
mAutoScrollAccumulator = -mAutoScrollDelay + mAutoScrollSpeed;
|
mAutoScrollAccumulator = -mAutoScrollDelay + mAutoScrollSpeed;
|
||||||
|
|
Loading…
Reference in a new issue