Several small improvements to the video view style.

Also partly rearranged the UI menu.
This commit is contained in:
Leon Styhre 2020-09-13 14:28:06 +02:00
parent 7dea5fb7df
commit 02c9b4fb28
5 changed files with 59 additions and 41 deletions

View file

@ -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_. 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)_ **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. 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. 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** **On-screen help**
Activating or deactivating the built-in help systems that provides contextual information regarding button usage. 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** **Show start menu in kid mode**
Hiding or showing the menu when the UI mode is set to Kid. Hiding or showing the menu when the UI mode is set to Kid.

View file

@ -390,7 +390,7 @@ void GuiMenu::openUISettings()
#if defined(USE_OPENGL_21) #if defined(USE_OPENGL_21)
// Open menu effect. // Open menu effect.
auto open_menu_effect = std::make_shared<OptionListComponent<std::string>> auto open_menu_effect = std::make_shared<OptionListComponent<std::string>>
(mWindow, getHelpStyle(), "OPEN MENU EFFECT", false); (mWindow, getHelpStyle(), "MENU OPENING EFFECT", false);
std::vector<std::string> menu_effects; std::vector<std::string> menu_effects;
menu_effects.push_back("scale-up"); menu_effects.push_back("scale-up");
menu_effects.push_back("fade-in"); menu_effects.push_back("fade-in");
@ -409,7 +409,23 @@ void GuiMenu::openUISettings()
if (needReload) if (needReload)
ViewController::get()->reloadAll(); ViewController::get()->reloadAll();
}); });
#endif
// Carousel transition option.
auto move_carousel = std::make_shared<SwitchComponent>(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. // Render scanlines for videos in the gamelists using a shader.
auto render_video_scanlines = std::make_shared<SwitchComponent>(mWindow); auto render_video_scanlines = std::make_shared<SwitchComponent>(mWindow);
render_video_scanlines->setState(Settings::getInstance()->getBool("GamelistVideoScanlines")); render_video_scanlines->setState(Settings::getInstance()->getBool("GamelistVideoScanlines"));
@ -488,20 +504,6 @@ void GuiMenu::openUISettings()
s->addSaveFunc([quick_sys_select] { Settings::getInstance()->setBool("QuickSystemSelect", s->addSaveFunc([quick_sys_select] { Settings::getInstance()->setBool("QuickSystemSelect",
quick_sys_select->getState()); }); quick_sys_select->getState()); });
// Carousel transition option.
auto move_carousel = std::make_shared<SwitchComponent>(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. // Show help.
auto show_help = std::make_shared<SwitchComponent>(mWindow); auto show_help = std::make_shared<SwitchComponent>(mWindow);
show_help->setState(Settings::getInstance()->getBool("ShowHelpPrompts")); show_help->setState(Settings::getInstance()->getBool("ShowHelpPrompts"));
@ -509,6 +511,14 @@ void GuiMenu::openUISettings()
s->addSaveFunc([show_help] { Settings::getInstance()->setBool("ShowHelpPrompts", s->addSaveFunc([show_help] { Settings::getInstance()->setBool("ShowHelpPrompts",
show_help->getState()); }); show_help->getState()); });
// Play videos immediately (overrides theme setting).
auto play_videos_immediately = std::make_shared<SwitchComponent>(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. // Whether to show start menu in Kid Mode.
auto show_kidstartmenu = std::make_shared<SwitchComponent>(mWindow); auto show_kidstartmenu = std::make_shared<SwitchComponent>(mWindow);
show_kidstartmenu->setState(Settings::getInstance()->getBool("ShowKidStartMenu")); show_kidstartmenu->setState(Settings::getInstance()->getBool("ShowKidStartMenu"));

View file

@ -85,13 +85,14 @@ void Settings::setDefaults()
mStringMap["UIMode"] = "full"; mStringMap["UIMode"] = "full";
mStringMap["DefaultSortOrder"] = "filename, ascending"; mStringMap["DefaultSortOrder"] = "filename, ascending";
mStringMap["MenuOpeningEffect"] = "scale-up"; mStringMap["MenuOpeningEffect"] = "scale-up";
mBoolMap["MoveCarousel"] = true;
mBoolMap["GamelistVideoScanlines"] = true; mBoolMap["GamelistVideoScanlines"] = true;
mBoolMap["FoldersOnTop"] = true; mBoolMap["FoldersOnTop"] = true;
mBoolMap["FavoritesFirst"] = true; mBoolMap["FavoritesFirst"] = true;
mBoolMap["ForceDisableFilters"] = false; mBoolMap["ForceDisableFilters"] = false;
mBoolMap["QuickSystemSelect"] = true; mBoolMap["QuickSystemSelect"] = true;
mBoolMap["MoveCarousel"] = true;
mBoolMap["ShowHelpPrompts"] = true; mBoolMap["ShowHelpPrompts"] = true;
mBoolMap["PlayVideosImmediately"] = false;
mBoolMap["ShowKidStartMenu"] = false; mBoolMap["ShowKidStartMenu"] = false;
// UI settings -> scrensaver settings. // UI settings -> scrensaver settings.

View file

@ -14,7 +14,9 @@
#include <SDL2/SDL_timer.h> #include <SDL2/SDL_timer.h>
#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 getTitlePath() {
std::string titleFolder = getTitleFolder(); std::string titleFolder = getTitleFolder();
@ -141,7 +143,7 @@ void VideoComponent::setImage(std::string path)
return; return;
mStaticImage.setImage(path); mStaticImage.setImage(path);
mFadeIn = 0.0f; mFadeIn = FADE_IN_START_OPACITY;
mStaticImagePath = path; mStaticImagePath = path;
} }
@ -152,7 +154,6 @@ void VideoComponent::setDefaultVideo()
void VideoComponent::setOpacity(unsigned char opacity) void VideoComponent::setOpacity(unsigned char opacity)
{ {
mOpacity = opacity;
// Update the embeded static image. // Update the embeded static image.
mStaticImage.setOpacity(opacity); mStaticImage.setOpacity(opacity);
} }
@ -184,7 +185,7 @@ void VideoComponent::renderSnapshot(const Transform4x4f& parentTrans)
if ((mConfig.showSnapshotNoVideo && mVideoPath.empty()) || if ((mConfig.showSnapshotNoVideo && mVideoPath.empty()) ||
(mStartDelayed && mConfig.showSnapshotDelay)) { (mStartDelayed && mConfig.showSnapshotDelay)) {
// Display the static image instead. // Display the static image instead.
mStaticImage.setOpacity((unsigned char)(mFadeIn * 255.0f)); mStaticImage.setOpacity(static_cast<unsigned char>(mFadeIn * 255.0f));
mStaticImage.render(parentTrans); mStaticImage.render(parentTrans);
} }
} }
@ -202,8 +203,9 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme, const s
if (!elem) if (!elem)
return; return;
Vector2f scale = getParent() ? getParent()->getSize() Vector2f scale = getParent() ? getParent()->getSize() :
: Vector2f((float)Renderer::getScreenWidth(), (float)Renderer::getScreenHeight()); Vector2f(static_cast<float>(Renderer::getScreenWidth()),
static_cast<float>(Renderer::getScreenHeight()));
if (properties & ThemeFlags::SIZE) { if (properties & ThemeFlags::SIZE) {
if (elem->has("size")) if (elem->has("size"))
@ -216,7 +218,7 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme, const s
mConfig.defaultVideoPath = elem->get<std::string>("default"); mConfig.defaultVideoPath = elem->get<std::string>("default");
if ((properties & ThemeFlags::DELAY) && elem->has("delay")) if ((properties & ThemeFlags::DELAY) && elem->has("delay"))
mConfig.startDelay = (unsigned)(elem->get<float>("delay") * 1000.0f); mConfig.startDelay = static_cast<unsigned>((elem->get<float>("delay") * 1000.0f));
if (elem->has("showSnapshotNoVideo")) if (elem->has("showSnapshotNoVideo"))
mConfig.showSnapshotNoVideo = elem->get<bool>("showSnapshotNoVideo"); mConfig.showSnapshotNoVideo = elem->get<bool>("showSnapshotNoVideo");
@ -236,9 +238,13 @@ void VideoComponent::handleStartDelay()
{ {
// Only play if any delay has timed out. // Only play if any delay has timed out.
if (mStartDelayed) { if (mStartDelayed) {
if (mStartTime > SDL_GetTicks()) { // If the setting to override the theme-supplied video delay setting has been enabled,
// Timeout not yet completed. // then play the video immediately.
return; if (!Settings::getInstance()->getBool("PlayVideosImmediately")) {
if (mStartTime > SDL_GetTicks()) {
// Timeout not yet completed.
return;
}
} }
// Completed. // Completed.
mStartDelayed = false; mStartDelayed = false;
@ -269,7 +275,7 @@ void VideoComponent::startVideoWithDelay()
else { else {
// Configure the start delay. // Configure the start delay.
mStartDelayed = true; mStartDelayed = true;
mFadeIn = 0.0f; mFadeIn = FADE_IN_START_OPACITY;
mStartTime = SDL_GetTicks() + mConfig.startDelay; mStartTime = SDL_GetTicks() + mConfig.startDelay;
} }
mIsPlaying = true; mIsPlaying = true;
@ -286,18 +292,15 @@ void VideoComponent::update(int deltaTime)
Uint32 ticks = SDL_GetTicks(); Uint32 ticks = SDL_GetTicks();
if (mStartTime > ticks) { if (mStartTime > ticks) {
Uint32 diff = mStartTime - ticks; Uint32 diff = mStartTime - ticks;
if (diff < FADE_TIME_MS) { if (diff < FADE_OUT_TIME) {
mFadeIn = (float)diff / (float)FADE_TIME_MS; mFadeIn = static_cast<float>(diff) / static_cast<float>(FADE_OUT_TIME);
return; return;
} }
} }
} }
// If the fade in is less than 1 then increment it. if (mFadeIn < 1.0f)
if (mFadeIn < 1.0f) { mFadeIn = Math::clamp(mFadeIn + (deltaTime / static_cast<float>(FADE_IN_TIME)), 0.0, 1.0);
mFadeIn += deltaTime / (float)FADE_TIME_MS;
if (mFadeIn > 1.0f)
mFadeIn = 1.0f;
}
GuiComponent::update(deltaTime); GuiComponent::update(deltaTime);
} }

View file

@ -284,9 +284,9 @@ based on: 'recalbox-multi' by the Recalbox community
<origin>0.5 0.5</origin> <origin>0.5 0.5</origin>
<pos>0.63 0.45</pos> <pos>0.63 0.45</pos>
<maxSize>0.360 0.424</maxSize> <maxSize>0.360 0.424</maxSize>
<delay>0.1</delay> <delay>1.7</delay>
<showSnapshotNoVideo>true</showSnapshotNoVideo> <showSnapshotNoVideo>true</showSnapshotNoVideo>
<showSnapshotDelay>false</showSnapshotDelay> <showSnapshotDelay>true</showSnapshotDelay>
</video> </video>
</view> </view>
</feature> </feature>