mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45:38 +00:00
Added some missing fade animation code to GridGameListView.
This commit is contained in:
parent
4d9ea680b0
commit
546a30d3ea
|
@ -16,6 +16,9 @@
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "SystemData.h"
|
#include "SystemData.h"
|
||||||
|
|
||||||
|
#define FADE_IN_START_OPACITY 0.5f
|
||||||
|
#define FADE_IN_TIME 650
|
||||||
|
|
||||||
GridGameListView::GridGameListView(
|
GridGameListView::GridGameListView(
|
||||||
Window* window,
|
Window* window,
|
||||||
FileData* root)
|
FileData* root)
|
||||||
|
@ -472,6 +475,13 @@ void GridGameListView::updateInfoPanel()
|
||||||
|
|
||||||
mGamelistInfo.setValue(gamelistInfoString);
|
mGamelistInfo.setValue(gamelistInfoString);
|
||||||
|
|
||||||
|
// Fade in the game image.
|
||||||
|
auto func = [this](float t) {
|
||||||
|
mImage.setOpacity(static_cast<unsigned char>(Math::lerp(
|
||||||
|
static_cast<float>(FADE_IN_START_OPACITY), 1.0f, t) * 255));
|
||||||
|
};
|
||||||
|
mImage.setAnimation(new LambdaAnimation(func, FADE_IN_TIME), 0, nullptr, false);
|
||||||
|
|
||||||
mDescription.setText(file->metadata.get("desc"));
|
mDescription.setText(file->metadata.get("desc"));
|
||||||
mDescContainer.reset();
|
mDescContainer.reset();
|
||||||
|
|
||||||
|
@ -515,7 +525,8 @@ void GridGameListView::updateInfoPanel()
|
||||||
if ((comp->isAnimationPlaying(0) && comp->isAnimationReversed(0) != fadingOut) ||
|
if ((comp->isAnimationPlaying(0) && comp->isAnimationReversed(0) != fadingOut) ||
|
||||||
(!comp->isAnimationPlaying(0) && comp->getOpacity() != (fadingOut ? 0 : 255))) {
|
(!comp->isAnimationPlaying(0) && comp->getOpacity() != (fadingOut ? 0 : 255))) {
|
||||||
auto func = [comp](float t) {
|
auto func = [comp](float t) {
|
||||||
comp->setOpacity(static_cast<unsigned char>(Math::lerp(0.0f, 1.0f, t) * 255));
|
// TEMPORARY - This does not seem to work, needs to be reviewed later.
|
||||||
|
// comp->setOpacity(static_cast<unsigned char>(Math::lerp(0.0f, 1.0f, t) * 255));
|
||||||
};
|
};
|
||||||
comp->setAnimation(new LambdaAnimation(func, 150), 0, nullptr, fadingOut);
|
comp->setAnimation(new LambdaAnimation(func, 150), 0, nullptr, fadingOut);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue