mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-31 04:25:40 +00:00
Added initial game selector support to SystemView.
This commit is contained in:
parent
81b819a96a
commit
57a594225a
|
@ -63,6 +63,7 @@ void SystemView::goToSystem(SystemData* system, bool animate)
|
||||||
{
|
{
|
||||||
mCarousel->setCursor(system);
|
mCarousel->setCursor(system);
|
||||||
updateGameCount();
|
updateGameCount();
|
||||||
|
updateGameSelector();
|
||||||
|
|
||||||
if (!animate)
|
if (!animate)
|
||||||
finishSystemAnimation(0);
|
finishSystemAnimation(0);
|
||||||
|
@ -173,11 +174,10 @@ HelpStyle SystemView::getHelpStyle()
|
||||||
|
|
||||||
void SystemView::onCursorChanged(const CursorState& /*state*/)
|
void SystemView::onCursorChanged(const CursorState& /*state*/)
|
||||||
{
|
{
|
||||||
// Update help style.
|
|
||||||
updateHelpPrompts();
|
updateHelpPrompts();
|
||||||
|
updateGameSelector();
|
||||||
|
|
||||||
int scrollVelocity {mCarousel->getScrollingVelocity()};
|
int scrollVelocity {mCarousel->getScrollingVelocity()};
|
||||||
|
|
||||||
float startPos {mCamOffset};
|
float startPos {mCamOffset};
|
||||||
float posMax {static_cast<float>(mCarousel->getNumEntries())};
|
float posMax {static_cast<float>(mCarousel->getNumEntries())};
|
||||||
float target {static_cast<float>(mCarousel->getCursor())};
|
float target {static_cast<float>(mCarousel->getCursor())};
|
||||||
|
@ -336,6 +336,12 @@ void SystemView::populate()
|
||||||
elements.name = it->getName();
|
elements.name = it->getName();
|
||||||
elements.fullName = it->getFullName();
|
elements.fullName = it->getFullName();
|
||||||
for (auto& element : theme->getViewElements("system").elements) {
|
for (auto& element : theme->getViewElements("system").elements) {
|
||||||
|
if (element.second.type == "gameselector") {
|
||||||
|
elements.gameSelector = std::make_unique<GameSelectorComponent>(it);
|
||||||
|
elements.gameSelector->applyTheme(theme, "system", element.first,
|
||||||
|
ThemeFlags::ALL);
|
||||||
|
elements.gameSelector->refreshGames();
|
||||||
|
}
|
||||||
if (element.second.type == "carousel") {
|
if (element.second.type == "carousel") {
|
||||||
mCarousel->applyTheme(theme, "system", element.first, ThemeFlags::ALL);
|
mCarousel->applyTheme(theme, "system", element.first, ThemeFlags::ALL);
|
||||||
if (element.second.has("logo"))
|
if (element.second.has("logo"))
|
||||||
|
@ -420,6 +426,8 @@ void SystemView::populate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateGameSelector();
|
||||||
|
|
||||||
if (mCarousel->getNumEntries() == 0) {
|
if (mCarousel->getNumEntries() == 0) {
|
||||||
// Something is wrong, there is not a single system to show, check if UI mode is not full.
|
// Something is wrong, there is not a single system to show, check if UI mode is not full.
|
||||||
if (!UIModeController::getInstance()->isUIModeFull()) {
|
if (!UIModeController::getInstance()->isUIModeFull()) {
|
||||||
|
@ -489,6 +497,43 @@ void SystemView::updateGameCount()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SystemView::updateGameSelector()
|
||||||
|
{
|
||||||
|
int cursor {mCarousel->getCursor()};
|
||||||
|
|
||||||
|
if (mSystemElements[cursor].gameSelector != nullptr) {
|
||||||
|
mSystemElements[mCarousel->getCursor()].gameSelector->refreshGames();
|
||||||
|
std::vector<FileData*> games {mSystemElements[cursor].gameSelector->getGames()};
|
||||||
|
if (!games.empty()) {
|
||||||
|
if (!mLegacyMode) {
|
||||||
|
for (auto& image : mSystemElements[cursor].imageComponents) {
|
||||||
|
const std::string imageType {image->getThemeImageType()};
|
||||||
|
if (imageType == "image")
|
||||||
|
image->setImage(games.front()->getImagePath());
|
||||||
|
else if (image->getThemeImageType() == "miximage")
|
||||||
|
image->setImage(games.front()->getMiximagePath());
|
||||||
|
else if (image->getThemeImageType() == "marquee")
|
||||||
|
image->setImage(games.front()->getMarqueePath());
|
||||||
|
else if (image->getThemeImageType() == "screenshot")
|
||||||
|
image->setImage(games.front()->getScreenshotPath());
|
||||||
|
else if (image->getThemeImageType() == "titlescreen")
|
||||||
|
image->setImage(games.front()->getTitleScreenPath());
|
||||||
|
else if (image->getThemeImageType() == "cover")
|
||||||
|
image->setImage(games.front()->getCoverPath());
|
||||||
|
else if (image->getThemeImageType() == "backcover")
|
||||||
|
image->setImage(games.front()->getBackCoverPath());
|
||||||
|
else if (image->getThemeImageType() == "3dbox")
|
||||||
|
image->setImage(games.front()->get3DBoxPath());
|
||||||
|
else if (image->getThemeImageType() == "fanart")
|
||||||
|
image->setImage(games.front()->getFanArtPath());
|
||||||
|
else if (image->getThemeImageType() == "thumbnail")
|
||||||
|
image->setImage(games.front()->getThumbnailPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SystemView::legacyApplyTheme(const std::shared_ptr<ThemeData>& theme)
|
void SystemView::legacyApplyTheme(const std::shared_ptr<ThemeData>& theme)
|
||||||
{
|
{
|
||||||
if (theme->hasView("system"))
|
if (theme->hasView("system"))
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
#ifndef ES_APP_VIEWS_SYSTEM_VIEW_H
|
#ifndef ES_APP_VIEWS_SYSTEM_VIEW_H
|
||||||
#define ES_APP_VIEWS_SYSTEM_VIEW_H
|
#define ES_APP_VIEWS_SYSTEM_VIEW_H
|
||||||
|
|
||||||
|
#include "FileData.h"
|
||||||
#include "GuiComponent.h"
|
#include "GuiComponent.h"
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
#include "SystemData.h"
|
#include "SystemData.h"
|
||||||
#include "components/CarouselComponent.h"
|
#include "components/CarouselComponent.h"
|
||||||
#include "components/DateTimeComponent.h"
|
#include "components/GameSelectorComponent.h"
|
||||||
#include "components/LottieComponent.h"
|
#include "components/LottieComponent.h"
|
||||||
#include "components/ScrollableContainer.h"
|
|
||||||
#include "components/TextComponent.h"
|
#include "components/TextComponent.h"
|
||||||
#include "components/TextListComponent.h"
|
#include "components/TextListComponent.h"
|
||||||
#include "components/VideoFFmpegComponent.h"
|
#include "components/VideoFFmpegComponent.h"
|
||||||
|
@ -28,6 +28,7 @@ class SystemData;
|
||||||
struct SystemViewElements {
|
struct SystemViewElements {
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string fullName;
|
std::string fullName;
|
||||||
|
std::unique_ptr<GameSelectorComponent> gameSelector;
|
||||||
std::vector<GuiComponent*> legacyExtras;
|
std::vector<GuiComponent*> legacyExtras;
|
||||||
std::vector<GuiComponent*> children;
|
std::vector<GuiComponent*> children;
|
||||||
|
|
||||||
|
@ -36,8 +37,6 @@ struct SystemViewElements {
|
||||||
std::vector<std::unique_ptr<ImageComponent>> imageComponents;
|
std::vector<std::unique_ptr<ImageComponent>> imageComponents;
|
||||||
std::vector<std::unique_ptr<VideoFFmpegComponent>> videoComponents;
|
std::vector<std::unique_ptr<VideoFFmpegComponent>> videoComponents;
|
||||||
std::vector<std::unique_ptr<LottieComponent>> lottieAnimComponents;
|
std::vector<std::unique_ptr<LottieComponent>> lottieAnimComponents;
|
||||||
std::vector<std::unique_ptr<ScrollableContainer>> containerComponents;
|
|
||||||
std::vector<std::unique_ptr<TextComponent>> containerTextComponents;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SystemView : public GuiComponent
|
class SystemView : public GuiComponent
|
||||||
|
@ -78,6 +77,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
void populate();
|
void populate();
|
||||||
void updateGameCount();
|
void updateGameCount();
|
||||||
|
void updateGameSelector();
|
||||||
void legacyApplyTheme(const std::shared_ptr<ThemeData>& theme);
|
void legacyApplyTheme(const std::shared_ptr<ThemeData>& theme);
|
||||||
void renderElements(const glm::mat4& parentTrans, bool abovePrimary);
|
void renderElements(const glm::mat4& parentTrans, bool abovePrimary);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue