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

90 lines
2 KiB
C
Raw Normal View History

#pragma once
#ifndef ES_APP_VIEWS_SYSTEM_VIEW_H
#define ES_APP_VIEWS_SYSTEM_VIEW_H
#include "components/IList.h"
2017-11-01 22:21:10 +00:00
#include "components/TextComponent.h"
#include "resources/Font.h"
#include "GuiComponent.h"
#include <memory>
class AnimatedImageComponent;
2017-11-01 22:21:10 +00:00
class SystemData;
enum CarouselType : unsigned int
{
HORIZONTAL = 0,
2017-08-15 02:34:34 +00:00
VERTICAL = 1,
VERTICAL_WHEEL = 2
};
struct SystemViewData
{
std::shared_ptr<GuiComponent> logo;
std::vector<GuiComponent*> backgroundExtras;
};
struct SystemViewCarousel
{
CarouselType type;
Vector2f pos;
Vector2f size;
Vector2f origin;
float logoScale;
2017-08-15 02:34:34 +00:00
float logoRotation;
Vector2f logoRotationOrigin;
2017-08-15 02:34:34 +00:00
Alignment logoAlignment;
unsigned int color;
int maxLogoCount; // number of logos shown on the carousel
Vector2f logoSize;
float zIndex;
};
class SystemView : public IList<SystemViewData, SystemData*>
{
public:
SystemView(Window* window);
2017-08-15 02:34:34 +00:00
virtual void onShow() override;
virtual void onHide() override;
void goToSystem(SystemData* system, bool animate);
bool input(InputConfig* config, Input input) override;
void update(int deltaTime) override;
void render(const Transform4x4f& parentTrans) override;
void onThemeChanged(const std::shared_ptr<ThemeData>& theme);
std::vector<HelpPrompt> getHelpPrompts() override;
virtual HelpStyle getHelpStyle() override;
protected:
void onCursorChanged(const CursorState& state) override;
private:
void populate();
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 renderInfoBar(const Transform4x4f& trans);
void renderFade(const Transform4x4f& trans);
SystemViewCarousel mCarousel;
TextComponent mSystemInfo;
// unit is list index
float mCamOffset;
float mExtrasCamOffset;
float mExtrasFadeOpacity;
bool mViewNeedsReload;
2017-08-15 02:34:34 +00:00
bool mShowing;
};
#endif // ES_APP_VIEWS_SYSTEM_VIEW_H