diff --git a/USERGUIDE.md b/USERGUIDE.md index 98231313f..26b7dab6b 100644 --- a/USERGUIDE.md +++ b/USERGUIDE.md @@ -551,6 +551,10 @@ The order in which to sort your gamelists. This can be overriden per game system Animation to play when opening the main menu or the game options menu. Can be set to _scale-up_, _fade-in_ or _none_. +**Carousel transitions** + +Whether to perform an animation when transitioning between systems in the system view. + **Render scanlines for gamelist videos** _(OpenGL renderer only)_ Whether to use a shader to render scanlines for videos in the gamelist view. The effect is usually pretty subtle as the video is normally renderered in a limited size in the GUI, and the scanlines are sized relative to the video window size. @@ -571,14 +575,14 @@ Activating or deactivating the ability to filter your gamelists. Can normally be If activated, it will be possible to jump between gamelists using the Left and Right buttons without having to first go back to the system view. -**Carousel transitions** - -Whether to perform an animation when transitioning between systems in the system view. - **On-screen help** Activating or deactivating the built-in help systems that provides contextual information regarding button usage. +**Play videos immediately (override theme)** + +Some themes (including rbsimple-DE) display the game images briefly before playing the game videos. This setting forces the videos to be played immediately, regardless of the configuration in the theme. + **Show start menu in kid mode** Hiding or showing the menu when the UI mode is set to Kid. diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 108ac6fa4..6105decdc 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -390,7 +390,7 @@ void GuiMenu::openUISettings() #if defined(USE_OPENGL_21) // Open menu effect. auto open_menu_effect = std::make_shared> - (mWindow, getHelpStyle(), "OPEN MENU EFFECT", false); + (mWindow, getHelpStyle(), "MENU OPENING EFFECT", false); std::vector menu_effects; menu_effects.push_back("scale-up"); menu_effects.push_back("fade-in"); @@ -409,7 +409,23 @@ void GuiMenu::openUISettings() if (needReload) ViewController::get()->reloadAll(); }); + #endif + // Carousel transition option. + auto move_carousel = std::make_shared(mWindow); + move_carousel->setState(Settings::getInstance()->getBool("MoveCarousel")); + s->addWithLabel("CAROUSEL TRANSITIONS", move_carousel); + s->addSaveFunc([move_carousel] { + if (move_carousel->getState() && + !Settings::getInstance()->getBool("MoveCarousel") && + PowerSaver::getMode() == PowerSaver::INSTANT) { + Settings::getInstance()->setString("PowerSaverMode", "default"); + PowerSaver::init(); + } + Settings::getInstance()->setBool("MoveCarousel", move_carousel->getState()); + }); + + #if defined(USE_OPENGL_21) // Render scanlines for videos in the gamelists using a shader. auto render_video_scanlines = std::make_shared(mWindow); render_video_scanlines->setState(Settings::getInstance()->getBool("GamelistVideoScanlines")); @@ -488,20 +504,6 @@ void GuiMenu::openUISettings() s->addSaveFunc([quick_sys_select] { Settings::getInstance()->setBool("QuickSystemSelect", quick_sys_select->getState()); }); - // Carousel transition option. - auto move_carousel = std::make_shared(mWindow); - move_carousel->setState(Settings::getInstance()->getBool("MoveCarousel")); - s->addWithLabel("CAROUSEL TRANSITIONS", move_carousel); - s->addSaveFunc([move_carousel] { - if (move_carousel->getState() && - !Settings::getInstance()->getBool("MoveCarousel") && - PowerSaver::getMode() == PowerSaver::INSTANT) { - Settings::getInstance()->setString("PowerSaverMode", "default"); - PowerSaver::init(); - } - Settings::getInstance()->setBool("MoveCarousel", move_carousel->getState()); - }); - // Show help. auto show_help = std::make_shared(mWindow); show_help->setState(Settings::getInstance()->getBool("ShowHelpPrompts")); @@ -509,6 +511,14 @@ void GuiMenu::openUISettings() s->addSaveFunc([show_help] { Settings::getInstance()->setBool("ShowHelpPrompts", show_help->getState()); }); + // Play videos immediately (overrides theme setting). + auto play_videos_immediately = std::make_shared(mWindow); + play_videos_immediately->setState(Settings::getInstance()->getBool("PlayVideosImmediately")); + s->addWithLabel("PLAY VIDEOS IMMEDIATELY (OVERRIDE THEME)", play_videos_immediately); + s->addSaveFunc([play_videos_immediately] { + Settings::getInstance()->setBool("PlayVideosImmediately", + play_videos_immediately->getState()); }); + // Whether to show start menu in Kid Mode. auto show_kidstartmenu = std::make_shared(mWindow); show_kidstartmenu->setState(Settings::getInstance()->getBool("ShowKidStartMenu")); diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index ca357d3df..ea06100ea 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -85,13 +85,14 @@ void Settings::setDefaults() mStringMap["UIMode"] = "full"; mStringMap["DefaultSortOrder"] = "filename, ascending"; mStringMap["MenuOpeningEffect"] = "scale-up"; + mBoolMap["MoveCarousel"] = true; mBoolMap["GamelistVideoScanlines"] = true; mBoolMap["FoldersOnTop"] = true; mBoolMap["FavoritesFirst"] = true; mBoolMap["ForceDisableFilters"] = false; mBoolMap["QuickSystemSelect"] = true; - mBoolMap["MoveCarousel"] = true; mBoolMap["ShowHelpPrompts"] = true; + mBoolMap["PlayVideosImmediately"] = false; mBoolMap["ShowKidStartMenu"] = false; // UI settings -> scrensaver settings. diff --git a/es-core/src/components/VideoComponent.cpp b/es-core/src/components/VideoComponent.cpp index 89766b362..51888068a 100644 --- a/es-core/src/components/VideoComponent.cpp +++ b/es-core/src/components/VideoComponent.cpp @@ -14,7 +14,9 @@ #include -#define FADE_TIME_MS 200 +#define FADE_IN_START_OPACITY 0.5f +#define FADE_IN_TIME 1300 +#define FADE_OUT_TIME 100 std::string getTitlePath() { std::string titleFolder = getTitleFolder(); @@ -141,7 +143,7 @@ void VideoComponent::setImage(std::string path) return; mStaticImage.setImage(path); - mFadeIn = 0.0f; + mFadeIn = FADE_IN_START_OPACITY; mStaticImagePath = path; } @@ -152,7 +154,6 @@ void VideoComponent::setDefaultVideo() void VideoComponent::setOpacity(unsigned char opacity) { - mOpacity = opacity; // Update the embeded static image. mStaticImage.setOpacity(opacity); } @@ -184,7 +185,7 @@ void VideoComponent::renderSnapshot(const Transform4x4f& parentTrans) if ((mConfig.showSnapshotNoVideo && mVideoPath.empty()) || (mStartDelayed && mConfig.showSnapshotDelay)) { // Display the static image instead. - mStaticImage.setOpacity((unsigned char)(mFadeIn * 255.0f)); + mStaticImage.setOpacity(static_cast(mFadeIn * 255.0f)); mStaticImage.render(parentTrans); } } @@ -202,8 +203,9 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, const s if (!elem) return; - Vector2f scale = getParent() ? getParent()->getSize() - : Vector2f((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); + Vector2f scale = getParent() ? getParent()->getSize() : + Vector2f(static_cast(Renderer::getScreenWidth()), + static_cast(Renderer::getScreenHeight())); if (properties & ThemeFlags::SIZE) { if (elem->has("size")) @@ -216,7 +218,7 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, const s mConfig.defaultVideoPath = elem->get("default"); if ((properties & ThemeFlags::DELAY) && elem->has("delay")) - mConfig.startDelay = (unsigned)(elem->get("delay") * 1000.0f); + mConfig.startDelay = static_cast((elem->get("delay") * 1000.0f)); if (elem->has("showSnapshotNoVideo")) mConfig.showSnapshotNoVideo = elem->get("showSnapshotNoVideo"); @@ -236,9 +238,13 @@ void VideoComponent::handleStartDelay() { // Only play if any delay has timed out. if (mStartDelayed) { - if (mStartTime > SDL_GetTicks()) { - // Timeout not yet completed. - return; + // If the setting to override the theme-supplied video delay setting has been enabled, + // then play the video immediately. + if (!Settings::getInstance()->getBool("PlayVideosImmediately")) { + if (mStartTime > SDL_GetTicks()) { + // Timeout not yet completed. + return; + } } // Completed. mStartDelayed = false; @@ -269,7 +275,7 @@ void VideoComponent::startVideoWithDelay() else { // Configure the start delay. mStartDelayed = true; - mFadeIn = 0.0f; + mFadeIn = FADE_IN_START_OPACITY; mStartTime = SDL_GetTicks() + mConfig.startDelay; } mIsPlaying = true; @@ -286,18 +292,15 @@ void VideoComponent::update(int deltaTime) Uint32 ticks = SDL_GetTicks(); if (mStartTime > ticks) { Uint32 diff = mStartTime - ticks; - if (diff < FADE_TIME_MS) { - mFadeIn = (float)diff / (float)FADE_TIME_MS; + if (diff < FADE_OUT_TIME) { + mFadeIn = static_cast(diff) / static_cast(FADE_OUT_TIME); return; } } } - // If the fade in is less than 1 then increment it. - if (mFadeIn < 1.0f) { - mFadeIn += deltaTime / (float)FADE_TIME_MS; - if (mFadeIn > 1.0f) - mFadeIn = 1.0f; - } + if (mFadeIn < 1.0f) + mFadeIn = Math::clamp(mFadeIn + (deltaTime / static_cast(FADE_IN_TIME)), 0.0, 1.0); + GuiComponent::update(deltaTime); } diff --git a/themes/rbsimple-DE/theme.xml b/themes/rbsimple-DE/theme.xml index 699432655..a0a92b35d 100644 --- a/themes/rbsimple-DE/theme.xml +++ b/themes/rbsimple-DE/theme.xml @@ -284,9 +284,9 @@ based on: 'recalbox-multi' by the Recalbox community 0.5 0.5 0.63 0.45 0.360 0.424 - 0.1 + 1.7 true - false + true