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"
|
|
|
|
#include "components/CarouselComponent.h"
|
2022-02-13 21:30:03 +00:00
|
|
|
#include "components/GameSelectorComponent.h"
|
2022-01-30 20:16:03 +00:00
|
|
|
#include "components/LottieComponent.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "components/TextComponent.h"
|
2022-01-30 20:16:03 +00:00
|
|
|
#include "components/TextListComponent.h"
|
|
|
|
#include "components/VideoFFmpegComponent.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
|
|
|
struct SystemViewElements {
|
|
|
|
std::string name;
|
2022-02-06 19:13:53 +00:00
|
|
|
std::string fullName;
|
2022-02-14 18:32:07 +00:00
|
|
|
std::vector<std::unique_ptr<GameSelectorComponent>> gameSelectors;
|
2022-02-06 13:01:40 +00:00
|
|
|
std::vector<GuiComponent*> legacyExtras;
|
|
|
|
std::vector<GuiComponent*> children;
|
|
|
|
|
2022-02-06 19:13:53 +00:00
|
|
|
std::vector<std::unique_ptr<TextComponent>> gameCountComponents;
|
2022-02-06 13:01:40 +00:00
|
|
|
std::vector<std::unique_ptr<TextComponent>> textComponents;
|
|
|
|
std::vector<std::unique_ptr<ImageComponent>> imageComponents;
|
|
|
|
std::vector<std::unique_ptr<VideoFFmpegComponent>> videoComponents;
|
|
|
|
std::vector<std::unique_ptr<LottieComponent>> lottieAnimComponents;
|
2017-03-13 21:11:07 +00:00
|
|
|
};
|
|
|
|
|
2022-02-06 13:01:40 +00:00
|
|
|
class SystemView : public GuiComponent
|
2014-06-25 16:29:58 +00:00
|
|
|
{
|
|
|
|
public:
|
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
|
|
|
|
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-02-06 13:01:40 +00:00
|
|
|
bool isScrolling() { return mCarousel->isScrolling(); }
|
|
|
|
void stopScrolling() { mCarousel->stopScrolling(); }
|
|
|
|
bool isSystemAnimationPlaying(unsigned char slot)
|
|
|
|
{
|
|
|
|
return mCarousel->isAnimationPlaying(slot);
|
|
|
|
}
|
|
|
|
void finishSystemAnimation(unsigned char slot)
|
|
|
|
{
|
|
|
|
finishAnimation(slot);
|
|
|
|
mCarousel->finishAnimation(slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
CarouselComponent::CarouselType getCarouselType() { return mCarousel->getType(); }
|
|
|
|
SystemData* getFirstSystem() { return mCarousel->getFirst(); }
|
|
|
|
|
2022-02-19 20:22:46 +00:00
|
|
|
void startViewVideos() override
|
|
|
|
{
|
|
|
|
for (auto& video : mSystemElements[mCarousel->getCursor()].videoComponents)
|
|
|
|
video->startVideoPlayer();
|
|
|
|
}
|
|
|
|
void stopViewVideos() override
|
|
|
|
{
|
|
|
|
for (auto& video : mSystemElements[mCarousel->getCursor()].videoComponents)
|
|
|
|
video->stopVideoPlayer();
|
|
|
|
}
|
|
|
|
void pauseViewVideos() override
|
|
|
|
{
|
|
|
|
for (auto& video : mSystemElements[mCarousel->getCursor()].videoComponents) {
|
|
|
|
video->pauseVideoPlayer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void muteViewVideos() override
|
|
|
|
{
|
|
|
|
for (auto& video : mSystemElements[mCarousel->getCursor()].videoComponents)
|
|
|
|
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-01-18 16:40:47 +00:00
|
|
|
HelpStyle getHelpStyle() override;
|
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-02-06 13:01:40 +00:00
|
|
|
std::unique_ptr<CarouselComponent> mCarousel;
|
2022-02-06 19:13:53 +00:00
|
|
|
std::unique_ptr<TextComponent> mLegacySystemInfo;
|
|
|
|
std::vector<SystemViewElements> mSystemElements;
|
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 mHoldingKey;
|
|
|
|
bool mNavigated;
|
2014-06-25 16:29:58 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_APP_VIEWS_SYSTEM_VIEW_H
|