The badge overlay images are now retained in the texture cache.

This commit is contained in:
Leon Styhre 2022-09-08 19:04:56 +02:00
parent b3148a7f74
commit a58153f08d
3 changed files with 7 additions and 1 deletions

View file

@ -137,6 +137,9 @@ void BadgeComponent::setBadges(const std::vector<BadgeInfo>& badges)
if (it2 != sGameControllers.cend()) {
it->overlayImage.setImage((*it2).fileName);
// This is done to keep the texture cache entry from expiring.
mOverlayMap[it2->shortName] =
std::make_unique<ImageComponent>(it->overlayImage);
}
else if (badge.gameController != "")
it->overlayImage.setImage(sGameControllers.back().fileName);

View file

@ -54,6 +54,9 @@ public:
private:
static inline std::vector<GameControllers> sGameControllers;
// Used to keep the overlay texture cache entries from expiring.
std::map<std::string, std::unique_ptr<ImageComponent>> mOverlayMap;
std::vector<FlexboxComponent::FlexboxItem> mFlexboxItems;
FlexboxComponent mFlexboxComponent;

View file

@ -23,7 +23,7 @@ public:
ImageComponent baseImage;
// Optional overlay image that can be sized and positioned relative to the base image.
ImageComponent overlayImage {false, false};
ImageComponent overlayImage;
glm::vec2 overlayPosition {0.5f, 0.5f};
float overlaySize {0.5f};