diff --git a/loader/include/Geode/cocos/sprite_nodes/CCSpriteFrameCache.h b/loader/include/Geode/cocos/sprite_nodes/CCSpriteFrameCache.h index 7890e0c5..78a0f344 100644 --- a/loader/include/Geode/cocos/sprite_nodes/CCSpriteFrameCache.h +++ b/loader/include/Geode/cocos/sprite_nodes/CCSpriteFrameCache.h @@ -152,6 +152,9 @@ public: * @js getInstance */ static CCSpriteFrameCache* sharedSpriteFrameCache(void); + GEODE_ADD( + static CCSpriteFrameCache* get(); + ); /** Purges the cache. It releases all the Sprite Frames and the retained instance. */ static void purgeSharedSpriteFrameCache(void); diff --git a/loader/include/Geode/cocos/textures/CCTextureCache.h b/loader/include/Geode/cocos/textures/CCTextureCache.h index 062cea61..13f2128a 100644 --- a/loader/include/Geode/cocos/textures/CCTextureCache.h +++ b/loader/include/Geode/cocos/textures/CCTextureCache.h @@ -91,6 +91,9 @@ public: * @js getInstance */ static CCTextureCache * sharedTextureCache(); + GEODE_ADD( + static CCTextureCache* get(); + ); /** purges the cache. It releases the retained instance. @since v0.99.0 diff --git a/loader/include/Geode/utils/ranges.hpp b/loader/include/Geode/utils/ranges.hpp index 6c3e6021..153e9aa9 100644 --- a/loader/include/Geode/utils/ranges.hpp +++ b/loader/include/Geode/utils/ranges.hpp @@ -169,6 +169,15 @@ namespace geode::utils::ranges { return container; } + template<ValidMutContainer C, ValidCUnaryPredicate<C> Predicate> + C& remove(C& container, Predicate fun) { + container.erase( + std::remove_if(container.begin(), container.end(), fun), + container.end() + ); + return container; + } + template<ValidContainer C, ValidCUnaryPredicate<C> Predicate> C filter(C const& container, Predicate filterFun) { auto res = C(); diff --git a/loader/src/cocos2d-ext/Getters.cpp b/loader/src/cocos2d-ext/Getters.cpp index 559ae67d..c5e4e2fc 100644 --- a/loader/src/cocos2d-ext/Getters.cpp +++ b/loader/src/cocos2d-ext/Getters.cpp @@ -28,4 +28,12 @@ CCFileUtils* CCFileUtils::get() { return CCFileUtils::sharedFileUtils(); } +CCSpriteFrameCache* CCSpriteFrameCache::get() { + return CCSpriteFrameCache::sharedSpriteFrameCache(); +} + +CCTextureCache* CCTextureCache::get() { + return CCTextureCache::sharedTextureCache(); +} + #pragma warning(pop)