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
|
|
|
|
|
|
|
#include "components/IList.h"
|
2017-11-01 22:21:10 +00:00
|
|
|
#include "components/TextComponent.h"
|
|
|
|
#include "resources/Font.h"
|
|
|
|
#include "GuiComponent.h"
|
2020-06-17 20:13:07 +00:00
|
|
|
#include "Sound.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;
|
|
|
|
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;
|
|
|
|
Vector2f pos;
|
|
|
|
Vector2f size;
|
|
|
|
Vector2f origin;
|
|
|
|
float logoScale;
|
|
|
|
float logoRotation;
|
|
|
|
Vector2f logoRotationOrigin;
|
|
|
|
Alignment logoAlignment;
|
|
|
|
unsigned int color;
|
|
|
|
unsigned int colorEnd;
|
|
|
|
bool colorGradientHorizontal;
|
|
|
|
int maxLogoCount; // Number of logos shown on the carousel.
|
|
|
|
Vector2f logoSize;
|
|
|
|
float zIndex;
|
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
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
virtual void onShow() override;
|
|
|
|
virtual void onHide() override;
|
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;
|
|
|
|
void render(const Transform4x4f& 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
|
|
|
|
|
|
|
protected:
|
2020-06-21 12:25:28 +00:00
|
|
|
void onCursorChanged(const CursorState& state) override;
|
2020-06-25 17:52:38 +00:00
|
|
|
virtual void onScroll() override {
|
2020-06-21 12:25:28 +00:00
|
|
|
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();
|
2020-06-21 12:25:28 +00:00
|
|
|
void getViewElements(const std::shared_ptr<ThemeData>& theme);
|
|
|
|
void getDefaultElements(void);
|
|
|
|
void getCarouselFromTheme(const ThemeData::ThemeElement* elem);
|
|
|
|
|
|
|
|
void renderCarousel(const Transform4x4f& parentTrans);
|
|
|
|
void renderExtras(const Transform4x4f& parentTrans, float lower, float upper);
|
|
|
|
void renderFade(const Transform4x4f& trans);
|
|
|
|
|
|
|
|
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
|