// 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 { std::string shortName; std::string displayName; std::string fileName; }; class BadgeComponent : public GuiComponent { public: BadgeComponent(); struct BadgeInfo { std::string badgeType; std::string gameController; bool folderLink {false}; }; static void populateGameControllers(); const std::vector& getBadgeTypes() const { return mBadgeTypes; } void setBadges(const std::vector& badges); static const std::vector& getGameControllers() { if (sGameControllers.empty()) populateGameControllers(); return sGameControllers; } 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(); } virtual void applyTheme(const std::shared_ptr& theme, const std::string& view, const std::string& element, unsigned int properties) override; private: static inline std::vector sGameControllers; // Used to keep the overlay texture cache entries from expiring. std::map> mOverlayMap; std::vector mFlexboxItems; FlexboxComponent mFlexboxComponent; std::vector mBadgeTypes; std::map mBadgeIcons; }; #endif // ES_CORE_COMPONENTS_BADGE_COMPONENT_H