2020-09-15 20:57:54 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-06-06 14:48:05 +00:00
|
|
|
//
|
2020-09-15 20:57:54 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-21 12:25:28 +00:00
|
|
|
// SystemView.h
|
2020-06-06 14:48:05 +00:00
|
|
|
//
|
2020-06-21 12:25:28 +00:00
|
|
|
// Main system view.
|
2020-06-06 14:48:05 +00:00
|
|
|
//
|
|
|
|
|
2017-10-31 17:12:50 +00:00
|
|
|
#ifndef ES_APP_VIEWS_SYSTEM_VIEW_H
|
|
|
|
#define ES_APP_VIEWS_SYSTEM_VIEW_H
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2022-02-13 21:30:03 +00:00
|
|
|
#include "FileData.h"
|
2021-07-07 18:03:42 +00:00
|
|
|
#include "GuiComponent.h"
|
|
|
|
#include "Sound.h"
|
2022-02-06 13:01:40 +00:00
|
|
|
#include "SystemData.h"
|
2022-02-20 14:49:32 +00:00
|
|
|
#include "components/DateTimeComponent.h"
|
2022-03-05 20:10:40 +00:00
|
|
|
#include "components/GIFAnimComponent.h"
|
2022-02-13 21:30:03 +00:00
|
|
|
#include "components/GameSelectorComponent.h"
|
2022-02-23 20:54:57 +00:00
|
|
|
#include "components/LottieAnimComponent.h"
|
2022-03-18 21:16:53 +00:00
|
|
|
#include "components/RatingComponent.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "components/TextComponent.h"
|
2022-01-30 20:16:03 +00:00
|
|
|
#include "components/VideoFFmpegComponent.h"
|
2022-03-24 22:05:23 +00:00
|
|
|
#include "components/primary/CarouselComponent.h"
|
|
|
|
#include "components/primary/TextListComponent.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "resources/Font.h"
|
2020-07-09 17:24:20 +00:00
|
|
|
|
2017-11-01 22:21:10 +00:00
|
|
|
#include <memory>
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2017-11-01 22:21:10 +00:00
|
|
|
class SystemData;
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2022-02-06 13:01:40 +00:00
|
|
|
class SystemView : public GuiComponent
|
2014-06-25 16:29:58 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-03-24 22:05:23 +00:00
|
|
|
using PrimaryType = PrimaryComponent<SystemData*>::PrimaryType;
|
|
|
|
|
2022-01-19 17:01:54 +00:00
|
|
|
SystemView();
|
2020-08-15 07:28:47 +00:00
|
|
|
~SystemView();
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2022-02-19 21:46:52 +00:00
|
|
|
void onTransition() override;
|
2020-06-21 12:25:28 +00:00
|
|
|
void goToSystem(SystemData* system, bool animate);
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
bool input(InputConfig* config, Input input) override;
|
|
|
|
void update(int deltaTime) override;
|
2021-08-15 17:30:31 +00:00
|
|
|
void render(const glm::mat4& parentTrans) override;
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2022-03-24 22:05:23 +00:00
|
|
|
bool isScrolling() { return mPrimary->isScrolling(); }
|
|
|
|
void stopScrolling() { mPrimary->stopScrolling(); }
|
|
|
|
bool isSystemAnimationPlaying(unsigned char slot) { return mPrimary->isAnimationPlaying(slot); }
|
2022-02-06 13:01:40 +00:00
|
|
|
void finishSystemAnimation(unsigned char slot)
|
|
|
|
{
|
|
|
|
finishAnimation(slot);
|
2022-03-24 22:05:23 +00:00
|
|
|
mPrimary->finishAnimation(slot);
|
2022-02-06 13:01:40 +00:00
|
|
|
}
|
|
|
|
|
2022-03-24 22:05:23 +00:00
|
|
|
PrimaryComponent<SystemData*>::PrimaryType getPrimaryType() { return mPrimaryType; }
|
|
|
|
CarouselComponent<SystemData*>::CarouselType getCarouselType()
|
|
|
|
{
|
|
|
|
return (mCarousel != nullptr) ? mCarousel->getType() :
|
|
|
|
CarouselComponent<SystemData*>::CarouselType::NO_CAROUSEL;
|
|
|
|
}
|
|
|
|
SystemData* getFirstSystem() { return mPrimary->getFirst(); }
|
2022-02-06 13:01:40 +00:00
|
|
|
|
2022-02-19 20:22:46 +00:00
|
|
|
void startViewVideos() override
|
|
|
|
{
|
2022-03-24 22:05:23 +00:00
|
|
|
for (auto& video : mSystemElements[mPrimary->getCursor()].videoComponents)
|
2022-02-19 20:22:46 +00:00
|
|
|
video->startVideoPlayer();
|
|
|
|
}
|
|
|
|
void stopViewVideos() override
|
|
|
|
{
|
2022-03-24 22:05:23 +00:00
|
|
|
for (auto& video : mSystemElements[mPrimary->getCursor()].videoComponents)
|
2022-02-19 20:22:46 +00:00
|
|
|
video->stopVideoPlayer();
|
|
|
|
}
|
|
|
|
void pauseViewVideos() override
|
|
|
|
{
|
2022-03-24 22:05:23 +00:00
|
|
|
for (auto& video : mSystemElements[mPrimary->getCursor()].videoComponents) {
|
2022-02-19 20:22:46 +00:00
|
|
|
video->pauseVideoPlayer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void muteViewVideos() override
|
|
|
|
{
|
2022-03-24 22:05:23 +00:00
|
|
|
for (auto& video : mSystemElements[mPrimary->getCursor()].videoComponents)
|
2022-02-19 20:22:46 +00:00
|
|
|
video->muteVideoPlayer();
|
|
|
|
}
|
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
void onThemeChanged(const std::shared_ptr<ThemeData>& theme);
|
2017-03-13 21:11:07 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
std::vector<HelpPrompt> getHelpPrompts() override;
|
2022-03-24 22:05:23 +00:00
|
|
|
HelpStyle getHelpStyle() override { return mSystemElements[mPrimary->getCursor()].helpStyle; }
|
2014-06-25 16:29:58 +00:00
|
|
|
|
|
|
|
protected:
|
2022-02-06 13:01:40 +00:00
|
|
|
void onCursorChanged(const CursorState& state);
|
2014-06-25 16:29:58 +00:00
|
|
|
|
|
|
|
private:
|
2020-06-21 12:25:28 +00:00
|
|
|
void populate();
|
2020-11-15 19:06:33 +00:00
|
|
|
void updateGameCount();
|
2022-02-14 18:32:07 +00:00
|
|
|
void updateGameSelectors();
|
2022-02-09 17:22:06 +00:00
|
|
|
void legacyApplyTheme(const std::shared_ptr<ThemeData>& theme);
|
|
|
|
void renderElements(const glm::mat4& parentTrans, bool abovePrimary);
|
2020-06-21 12:25:28 +00:00
|
|
|
|
2022-03-24 22:05:23 +00:00
|
|
|
struct SystemViewElements {
|
|
|
|
HelpStyle helpStyle;
|
|
|
|
std::string name;
|
|
|
|
std::string fullName;
|
|
|
|
std::vector<std::unique_ptr<GameSelectorComponent>> gameSelectors;
|
|
|
|
std::vector<GuiComponent*> legacyExtras;
|
|
|
|
std::vector<GuiComponent*> children;
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<ImageComponent>> imageComponents;
|
|
|
|
std::vector<std::unique_ptr<VideoFFmpegComponent>> videoComponents;
|
|
|
|
std::vector<std::unique_ptr<LottieAnimComponent>> lottieAnimComponents;
|
|
|
|
std::vector<std::unique_ptr<GIFAnimComponent>> GIFAnimComponents;
|
|
|
|
std::vector<std::unique_ptr<TextComponent>> gameCountComponents;
|
|
|
|
std::vector<std::unique_ptr<TextComponent>> textComponents;
|
|
|
|
std::vector<std::unique_ptr<DateTimeComponent>> dateTimeComponents;
|
|
|
|
std::vector<std::unique_ptr<RatingComponent>> ratingComponents;
|
|
|
|
};
|
|
|
|
|
2022-03-14 18:51:48 +00:00
|
|
|
Renderer* mRenderer;
|
2022-03-24 22:05:23 +00:00
|
|
|
std::unique_ptr<CarouselComponent<SystemData*>> mCarousel;
|
|
|
|
std::unique_ptr<TextListComponent<SystemData*>> mTextList;
|
2022-02-06 19:13:53 +00:00
|
|
|
std::unique_ptr<TextComponent> mLegacySystemInfo;
|
|
|
|
std::vector<SystemViewElements> mSystemElements;
|
2022-03-24 22:05:23 +00:00
|
|
|
PrimaryComponent<SystemData*>* mPrimary;
|
|
|
|
PrimaryType mPrimaryType;
|
2020-06-21 12:25:28 +00:00
|
|
|
|
2022-09-08 16:59:33 +00:00
|
|
|
// Dummy entry to keep the default SVG rating images in the texture cache so they don't
|
|
|
|
// need to be re-rasterized for each gamelist that is loaded.
|
|
|
|
RatingComponent mRatingDummy;
|
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
float mCamOffset;
|
2022-02-06 13:01:40 +00:00
|
|
|
float mFadeOpacity;
|
2022-02-08 23:05:06 +00:00
|
|
|
int mPreviousScrollVelocity;
|
2020-06-21 12:25:28 +00:00
|
|
|
|
2020-11-15 19:06:33 +00:00
|
|
|
bool mUpdatedGameCount;
|
2020-06-21 12:25:28 +00:00
|
|
|
bool mViewNeedsReload;
|
2022-01-30 20:16:03 +00:00
|
|
|
bool mLegacyMode;
|
2022-02-19 20:22:46 +00:00
|
|
|
bool mNavigated;
|
2022-03-11 22:20:27 +00:00
|
|
|
bool mMaxFade;
|
|
|
|
bool mFadeTransitions;
|
2014-06-25 16:29:58 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_APP_VIEWS_SYSTEM_VIEW_H
|