ES-DE/es-app/src/views/SystemView.h

132 lines
3.8 KiB
C
Raw Normal View History

// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// SystemView.h
//
// Main system view.
//
#ifndef ES_APP_VIEWS_SYSTEM_VIEW_H
#define ES_APP_VIEWS_SYSTEM_VIEW_H
#include "GuiComponent.h"
#include "Sound.h"
#include "components/BadgeComponent.h"
#include "components/DateTimeComponent.h"
#include "components/IList.h"
#include "components/LottieComponent.h"
#include "components/RatingComponent.h"
#include "components/ScrollableContainer.h"
2017-11-01 22:21:10 +00:00
#include "components/TextComponent.h"
#include "components/TextListComponent.h"
#include "components/VideoFFmpegComponent.h"
2017-11-01 22:21:10 +00:00
#include "resources/Font.h"
2017-11-01 22:21:10 +00:00
#include <memory>
2017-11-01 22:21:10 +00:00
class SystemData;
enum CarouselType : unsigned int {
HORIZONTAL = 0,
VERTICAL = 1,
VERTICAL_WHEEL = 2,
HORIZONTAL_WHEEL = 3
};
struct SystemViewData {
std::shared_ptr<GuiComponent> logo;
std::shared_ptr<GuiComponent> logoPlaceholderText;
std::vector<GuiComponent*> backgroundExtras;
std::vector<std::shared_ptr<TextComponent>> textComponents;
std::vector<std::shared_ptr<DateTimeComponent>> dateTimeComponents;
std::vector<std::shared_ptr<ImageComponent>> imageComponents;
std::vector<std::shared_ptr<VideoFFmpegComponent>> videoComponents;
std::vector<std::shared_ptr<LottieComponent>> lottieAnimComponents;
std::vector<std::shared_ptr<BadgeComponent>> badgeComponents;
std::vector<std::shared_ptr<RatingComponent>> ratingComponents;
std::vector<std::shared_ptr<ScrollableContainer>> containerComponents;
std::vector<std::shared_ptr<TextComponent>> containerTextComponents;
std::vector<std::shared_ptr<TextComponent>> gamelistInfoComponents;
};
struct SystemViewCarousel {
CarouselType type;
glm::vec2 pos;
glm::vec2 size;
glm::vec2 origin;
float logoScale;
float logoRotation;
glm::vec2 logoRotationOrigin;
Alignment logoAlignment;
unsigned int color;
unsigned int colorEnd;
bool colorGradientHorizontal;
int maxLogoCount; // Number of logos shown on the carousel.
glm::vec2 logoSize;
float zIndex;
bool legacyZIndexMode;
};
class SystemView : public IList<SystemViewData, SystemData*>
{
public:
SystemView();
~SystemView();
void onShow() override { mShowing = true; }
void onHide() override { mShowing = false; }
2017-08-15 02:34:34 +00:00
void goToSystem(SystemData* system, bool animate);
bool input(InputConfig* config, Input input) override;
void update(int deltaTime) override;
void render(const glm::mat4& parentTrans) override;
void onThemeChanged(const std::shared_ptr<ThemeData>& theme);
std::vector<HelpPrompt> getHelpPrompts() override;
HelpStyle getHelpStyle() override;
CarouselType getCarouselType() { return mCarousel.type; }
protected:
void onCursorChanged(const CursorState& state) override;
void onScroll() override
{
NavigationSounds::getInstance().playThemeNavigationSound(SYSTEMBROWSESOUND);
}
private:
void populate();
2020-11-15 19:06:33 +00:00
void updateGameCount();
// Get the ThemeElements that make up the SystemView.
void getViewElements(const std::shared_ptr<ThemeData>& theme);
// Populate the system carousel with the legacy values.
void getDefaultElements(void);
void getCarouselFromTheme(const ThemeData::ThemeElement* elem);
// Render system carousel.
void renderCarousel(const glm::mat4& parentTrans);
// Draw background extras.
void renderExtras(const glm::mat4& parentTrans, float lower, float upper);
void renderFade(const glm::mat4& trans);
SystemViewCarousel mCarousel;
TextComponent mSystemInfo;
// Unit is list index.
float mCamOffset;
float mExtrasCamOffset;
float mExtrasFadeOpacity;
int mPreviousScrollVelocity;
2020-11-15 19:06:33 +00:00
bool mUpdatedGameCount;
bool mViewNeedsReload;
bool mShowing;
bool mLegacyMode;
};
#endif // ES_APP_VIEWS_SYSTEM_VIEW_H