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
|
|
|
|
2021-07-07 18:03:42 +00:00
|
|
|
#include "GuiComponent.h"
|
|
|
|
#include "Sound.h"
|
2014-06-25 16:29:58 +00:00
|
|
|
#include "components/IList.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "components/TextComponent.h"
|
|
|
|
#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
|
|
|
|
|
|
|
class AnimatedImageComponent;
|
2017-11-01 22:21:10 +00:00
|
|
|
class SystemData;
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2020-06-06 14:48:05 +00:00
|
|
|
enum CarouselType : unsigned int {
|
2020-06-21 12:25:28 +00:00
|
|
|
HORIZONTAL = 0,
|
|
|
|
VERTICAL = 1,
|
|
|
|
VERTICAL_WHEEL = 2,
|
|
|
|
HORIZONTAL_WHEEL = 3
|
2017-03-13 21:11:07 +00:00
|
|
|
};
|
|
|
|
|
2020-06-06 14:48:05 +00:00
|
|
|
struct SystemViewData {
|
2020-06-21 12:25:28 +00:00
|
|
|
std::shared_ptr<GuiComponent> logo;
|
2021-10-11 21:12:21 +00:00
|
|
|
std::shared_ptr<GuiComponent> logoPlaceholderText;
|
2020-06-21 12:25:28 +00:00
|
|
|
std::vector<GuiComponent*> backgroundExtras;
|
2014-06-25 16:29:58 +00:00
|
|
|
};
|
|
|
|
|
2020-06-06 14:48:05 +00:00
|
|
|
struct SystemViewCarousel {
|
2020-06-21 12:25:28 +00:00
|
|
|
CarouselType type;
|
2021-08-16 16:25:01 +00:00
|
|
|
glm::vec2 pos;
|
|
|
|
glm::vec2 size;
|
|
|
|
glm::vec2 origin;
|
2020-06-21 12:25:28 +00:00
|
|
|
float logoScale;
|
|
|
|
float logoRotation;
|
2021-08-16 16:25:01 +00:00
|
|
|
glm::vec2 logoRotationOrigin;
|
2020-06-21 12:25:28 +00:00
|
|
|
Alignment logoAlignment;
|
|
|
|
unsigned int color;
|
|
|
|
unsigned int colorEnd;
|
|
|
|
bool colorGradientHorizontal;
|
|
|
|
int maxLogoCount; // Number of logos shown on the carousel.
|
2021-08-16 16:25:01 +00:00
|
|
|
glm::vec2 logoSize;
|
2020-06-21 12:25:28 +00:00
|
|
|
float zIndex;
|
2021-10-23 15:34:20 +00:00
|
|
|
bool legacyZIndexMode;
|
2017-03-13 21:11:07 +00:00
|
|
|
};
|
|
|
|
|
2014-06-25 16:29:58 +00:00
|
|
|
class SystemView : public IList<SystemViewData, SystemData*>
|
|
|
|
{
|
|
|
|
public:
|
2020-06-21 12:25:28 +00:00
|
|
|
SystemView(Window* window);
|
2020-08-15 07:28:47 +00:00
|
|
|
~SystemView();
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2021-07-07 18:03:42 +00:00
|
|
|
virtual void onShow() override { mShowing = true; }
|
|
|
|
virtual void onHide() override { mShowing = false; }
|
2017-08-15 02:34:34 +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
|
|
|
|
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;
|
|
|
|
virtual HelpStyle getHelpStyle() override;
|
2014-06-25 16:29:58 +00:00
|
|
|
|
2021-07-07 18:03:42 +00:00
|
|
|
CarouselType getCarouselType() { return mCarousel.type; }
|
2020-11-17 16:30:23 +00:00
|
|
|
|
2014-06-25 16:29:58 +00:00
|
|
|
protected:
|
2020-06-21 12:25:28 +00:00
|
|
|
void onCursorChanged(const CursorState& state) override;
|
2021-07-07 18:03:42 +00:00
|
|
|
virtual void onScroll() override
|
|
|
|
{
|
|
|
|
NavigationSounds::getInstance()->playThemeNavigationSound(SYSTEMBROWSESOUND);
|
|
|
|
}
|
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();
|
2021-08-15 17:30:31 +00:00
|
|
|
// Get the ThemeElements that make up the SystemView.
|
2020-06-21 12:25:28 +00:00
|
|
|
void getViewElements(const std::shared_ptr<ThemeData>& theme);
|
2021-08-15 17:30:31 +00:00
|
|
|
// Populate the system carousel with the legacy values.
|
2020-06-21 12:25:28 +00:00
|
|
|
void getDefaultElements(void);
|
|
|
|
void getCarouselFromTheme(const ThemeData::ThemeElement* elem);
|
|
|
|
|
2021-08-15 17:30:31 +00:00
|
|
|
// 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);
|
2020-06-21 12:25:28 +00:00
|
|
|
|
|
|
|
SystemViewCarousel mCarousel;
|
|
|
|
TextComponent mSystemInfo;
|
|
|
|
|
|
|
|
// Unit is list index.
|
|
|
|
float mCamOffset;
|
|
|
|
float mExtrasCamOffset;
|
|
|
|
float mExtrasFadeOpacity;
|
|
|
|
|
2020-11-15 10:30:43 +00:00
|
|
|
int mPreviousScrollVelocity;
|
2020-11-15 19:06:33 +00:00
|
|
|
bool mUpdatedGameCount;
|
2020-06-21 12:25:28 +00:00
|
|
|
bool mViewNeedsReload;
|
|
|
|
bool mShowing;
|
2014-06-25 16:29:58 +00:00
|
|
|
};
|
2017-10-31 17:12:50 +00:00
|
|
|
|
|
|
|
#endif // ES_APP_VIEWS_SYSTEM_VIEW_H
|