mirror of
https://github.com/geode-sdk/geode.git
synced 2025-03-22 02:45:49 -04:00
add more getters + ranges utils
This commit is contained in:
parent
e30669d9ad
commit
b252c69b8b
4 changed files with 23 additions and 0 deletions
loader
include/Geode
src/cocos2d-ext
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue