diff --git a/es-core/src/components/BadgeComponent.cpp b/es-core/src/components/BadgeComponent.cpp index 87d4c5753..658ed9922 100644 --- a/es-core/src/components/BadgeComponent.cpp +++ b/es-core/src/components/BadgeComponent.cpp @@ -137,6 +137,9 @@ void BadgeComponent::setBadges(const std::vector& 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(it->overlayImage); } else if (badge.gameController != "") it->overlayImage.setImage(sGameControllers.back().fileName); diff --git a/es-core/src/components/BadgeComponent.h b/es-core/src/components/BadgeComponent.h index 83da48341..6b1c88475 100644 --- a/es-core/src/components/BadgeComponent.h +++ b/es-core/src/components/BadgeComponent.h @@ -54,6 +54,9 @@ public: private: static inline std::vector sGameControllers; + // Used to keep the overlay texture cache entries from expiring. + std::map> mOverlayMap; + std::vector mFlexboxItems; FlexboxComponent mFlexboxComponent; diff --git a/es-core/src/components/FlexboxComponent.h b/es-core/src/components/FlexboxComponent.h index 529eb01c6..e525808cc 100644 --- a/es-core/src/components/FlexboxComponent.h +++ b/es-core/src/components/FlexboxComponent.h @@ -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};