2021-09-05 01:40:23 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
//
|
|
|
|
// EmulationStation Desktop Edition
|
2021-10-23 18:28:07 +00:00
|
|
|
// BadgeComponent.h
|
2021-09-05 01:40:23 +00:00
|
|
|
//
|
|
|
|
// Game badges icons.
|
2021-10-12 20:53:02 +00:00
|
|
|
// Used by the gamelist views.
|
2021-09-05 01:40:23 +00:00
|
|
|
//
|
|
|
|
|
2021-10-23 18:28:07 +00:00
|
|
|
#ifndef ES_CORE_COMPONENTS_BADGE_COMPONENT_H
|
|
|
|
#define ES_CORE_COMPONENTS_BADGE_COMPONENT_H
|
2021-09-05 01:40:23 +00:00
|
|
|
|
2021-09-07 15:21:54 +00:00
|
|
|
#include "FlexboxComponent.h"
|
2021-10-12 20:53:02 +00:00
|
|
|
#include "GuiComponent.h"
|
2021-09-05 01:40:23 +00:00
|
|
|
|
2021-10-23 18:14:17 +00:00
|
|
|
struct GameControllers {
|
2021-10-23 17:08:32 +00:00
|
|
|
std::string shortName;
|
|
|
|
std::string displayName;
|
|
|
|
std::string fileName;
|
|
|
|
};
|
|
|
|
|
2021-10-23 18:28:07 +00:00
|
|
|
class BadgeComponent : public GuiComponent
|
2021-09-05 01:40:23 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-01-19 17:01:54 +00:00
|
|
|
BadgeComponent();
|
2021-09-27 20:18:19 +00:00
|
|
|
|
2021-10-23 17:08:32 +00:00
|
|
|
struct BadgeInfo {
|
|
|
|
std::string badgeType;
|
2021-10-23 18:14:17 +00:00
|
|
|
std::string gameController;
|
2022-04-13 14:53:28 +00:00
|
|
|
bool folderLink {false};
|
2021-10-23 17:08:32 +00:00
|
|
|
};
|
|
|
|
|
2021-10-23 18:14:17 +00:00
|
|
|
static void populateGameControllers();
|
2021-11-09 21:40:08 +00:00
|
|
|
const std::vector<std::string>& getBadgeTypes() const { return mBadgeTypes; }
|
2021-10-23 17:08:32 +00:00
|
|
|
void setBadges(const std::vector<BadgeInfo>& badges);
|
2021-10-23 18:14:17 +00:00
|
|
|
static const std::vector<GameControllers>& getGameControllers()
|
2021-10-23 17:08:32 +00:00
|
|
|
{
|
2021-10-23 18:14:17 +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);
|
2021-09-05 01:40:23 +00:00
|
|
|
|
2021-10-12 20:53:02 +00:00
|
|
|
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,
|
2021-09-05 01:40:23 +00:00
|
|
|
unsigned int properties) override;
|
|
|
|
|
|
|
|
private:
|
2022-01-29 17:41:22 +00:00
|
|
|
static inline std::vector<GameControllers> sGameControllers;
|
2021-10-23 17:08:32 +00:00
|
|
|
|
|
|
|
std::vector<FlexboxComponent::FlexboxItem> mFlexboxItems;
|
2021-10-12 20:53:02 +00:00
|
|
|
FlexboxComponent mFlexboxComponent;
|
|
|
|
|
2021-10-11 19:28:37 +00:00
|
|
|
std::vector<std::string> mBadgeTypes;
|
2021-09-26 22:41:53 +00:00
|
|
|
std::map<std::string, std::string> mBadgeIcons;
|
2021-09-05 01:40:23 +00:00
|
|
|
};
|
|
|
|
|
2021-10-23 18:28:07 +00:00
|
|
|
#endif // ES_CORE_COMPONENTS_BADGE_COMPONENT_H
|