ES-DE/es-core/src/components/BadgeComponent.h

65 lines
1.8 KiB
C
Raw Normal View History

// SPDX-License-Identifier: MIT
//
// EmulationStation Desktop Edition
// BadgeComponent.h
//
// Game badges icons.
// Used by the gamelist views.
//
#ifndef ES_CORE_COMPONENTS_BADGE_COMPONENT_H
#define ES_CORE_COMPONENTS_BADGE_COMPONENT_H
#include "FlexboxComponent.h"
#include "GuiComponent.h"
struct GameControllers {
2021-10-23 17:08:32 +00:00
std::string shortName;
std::string displayName;
std::string fileName;
};
class BadgeComponent : public GuiComponent
{
public:
BadgeComponent();
2021-10-23 17:08:32 +00:00
struct BadgeInfo {
std::string badgeType;
std::string gameController;
bool folderLink {false};
2021-10-23 17:08:32 +00:00
};
static void populateGameControllers();
const std::vector<std::string>& getBadgeTypes() const { return mBadgeTypes; }
2021-10-23 17:08:32 +00:00
void setBadges(const std::vector<BadgeInfo>& badges);
static const std::vector<GameControllers>& getGameControllers()
2021-10-23 17:08:32 +00:00
{
if (sGameControllers.empty())
populateGameControllers();
return sGameControllers;
2021-10-23 17:08:32 +00:00
}
static const std::string getShortName(const std::string& displayName);
static const std::string getDisplayName(const std::string& shortName);
void render(const glm::mat4& parentTrans) override;
void onSizeChanged() override { mFlexboxComponent.onSizeChanged(); }
2021-09-27 19:06:07 +00:00
virtual void applyTheme(const std::shared_ptr<ThemeData>& theme,
const std::string& view,
const std::string& element,
unsigned int properties) override;
private:
static inline std::vector<GameControllers> sGameControllers;
2021-10-23 17:08:32 +00:00
std::vector<FlexboxComponent::FlexboxItem> mFlexboxItems;
FlexboxComponent mFlexboxComponent;
std::vector<std::string> mBadgeTypes;
std::map<std::string, std::string> mBadgeIcons;
};
#endif // ES_CORE_COMPONENTS_BADGE_COMPONENT_H