mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Added support for fade-in and fade-out of static videos.
This commit is contained in:
parent
6fd47a5599
commit
720a6fcc22
|
@ -194,6 +194,7 @@ void GamelistView::onThemeChanged(const std::shared_ptr<ThemeData>& theme)
|
||||||
ALL);
|
ALL);
|
||||||
if (mStaticVideoComponents.back()->getMetadataElement())
|
if (mStaticVideoComponents.back()->getMetadataElement())
|
||||||
mStaticVideoComponents.back()->setScrollHide(true);
|
mStaticVideoComponents.back()->setScrollHide(true);
|
||||||
|
mStaticVideoComponents.back()->setGeneralFade(true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mVideoComponents.push_back(std::make_unique<VideoFFmpegComponent>());
|
mVideoComponents.push_back(std::make_unique<VideoFFmpegComponent>());
|
||||||
|
|
|
@ -37,6 +37,7 @@ VideoComponent::VideoComponent()
|
||||||
, mRenderScanlines {false}
|
, mRenderScanlines {false}
|
||||||
, mLegacyTheme {false}
|
, mLegacyTheme {false}
|
||||||
, mHasVideo {false}
|
, mHasVideo {false}
|
||||||
|
, mGeneralFade {false}
|
||||||
, mFadeIn {1.0f}
|
, mFadeIn {1.0f}
|
||||||
, mFadeInTime {1000.0f}
|
, mFadeInTime {1000.0f}
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,8 @@ public:
|
||||||
void setOpacity(float opacity) override { mOpacity = opacity; }
|
void setOpacity(float opacity) override { mOpacity = opacity; }
|
||||||
// Set whether to draw black pillarboxes/letterboxes behind videos.
|
// Set whether to draw black pillarboxes/letterboxes behind videos.
|
||||||
void setDrawPillarboxes(bool state) { mDrawPillarboxes = state; }
|
void setDrawPillarboxes(bool state) { mDrawPillarboxes = state; }
|
||||||
|
// Whether to fade out the entire video surface including the black rectangle.
|
||||||
|
void setGeneralFade(bool state) { mGeneralFade = state; }
|
||||||
|
|
||||||
bool hasStaticVideo() { return !mConfig.staticVideoPath.empty(); }
|
bool hasStaticVideo() { return !mConfig.staticVideoPath.empty(); }
|
||||||
bool hasStaticImage() { return mStaticImage.getTextureSize() != glm::ivec2 {0, 0}; }
|
bool hasStaticImage() { return mStaticImage.getTextureSize() != glm::ivec2 {0, 0}; }
|
||||||
|
@ -129,6 +131,7 @@ protected:
|
||||||
bool mRenderScanlines;
|
bool mRenderScanlines;
|
||||||
bool mLegacyTheme;
|
bool mLegacyTheme;
|
||||||
bool mHasVideo;
|
bool mHasVideo;
|
||||||
|
bool mGeneralFade;
|
||||||
float mFadeIn;
|
float mFadeIn;
|
||||||
float mFadeInTime;
|
float mFadeInTime;
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,9 @@ void VideoFFmpegComponent::render(const glm::mat4& parentTrans)
|
||||||
|
|
||||||
unsigned int rectColor {0x000000FF};
|
unsigned int rectColor {0x000000FF};
|
||||||
|
|
||||||
if (mThemeOpacity != 1.0f)
|
if (!mGeneralFade && mThemeOpacity != 1.0f)
|
||||||
|
rectColor = static_cast<int>(mThemeOpacity * 255.0f);
|
||||||
|
if (mGeneralFade && (mOpacity != 1.0f || mThemeOpacity != 1.0f))
|
||||||
rectColor = static_cast<int>(mFadeIn * mOpacity * mThemeOpacity * 255.0f);
|
rectColor = static_cast<int>(mFadeIn * mOpacity * mThemeOpacity * 255.0f);
|
||||||
|
|
||||||
// Render the black rectangle behind the video.
|
// Render the black rectangle behind the video.
|
||||||
|
|
Loading…
Reference in a new issue