Singleton that handles the loading of the sprite frames. It saves in a cache the sprite frames.
Class CCSpriteFrameCache
#include <Geode/cocos/sprite_nodes/CCSpriteFrameCache.h>
Examples0
Public static methods3
staticcocos2d::CCSpriteFrameCache*get()
Public member functions11
boolinit()
voidaddSpriteFramesWithFile(charconst*pszPlist)
Adds multiple Sprite Frames from a plist file. A texture will be loaded automatically. The texture name will composed by replacing the .plist suffix with .png If you want to use another texture, you should use the addSpriteFramesWithFile:texture method.
voidaddSpriteFramesWithFile(charconst*plist,charconst*textureFileName)
Adds multiple Sprite Frames from a plist file. The texture will be associated with the created sprite frames.
voidaddSpriteFramesWithFile(charconst*pszPlist,cocos2d::CCTexture2D*pobTexture)
Adds multiple Sprite Frames from a plist file. The texture will be associated with the created sprite frames.
voidaddSpriteFrame(cocos2d::CCSpriteFrame*pobFrame,charconst*pszFrameName)
Adds an sprite frame with a given name. If the name already exists, then the contents of the old name will be replaced with the new one.
voidremoveSpriteFrames()
Purges the dictionary of loaded sprite frames. Call this method if you receive the “Memory Warning”. In the short term: it will free some resources preventing your app from being killed. In the medium term: it will allocate more resources. In the long term: it will be the same.
voidremoveUnusedSpriteFrames()
Removes unused sprite frames. Sprite Frames that have a retain count of 1 will be deleted. It is convenient to call this method after when starting a new Scene.
voidremoveSpriteFrameByName(charconst*pszName)
Deletes an sprite frame from the sprite frame cache.
voidremoveSpriteFramesFromFile(charconst*plist)
Removes multiple Sprite Frames from a plist file. Sprite Frames stored in this file will be removed. It is convenient to call this method when a specific texture needs to be removed.
voidremoveSpriteFramesFromTexture(cocos2d::CCTexture2D*texture)
Removes all Sprite Frames associated with the specified textures. It is convenient to call this method when a specific texture needs to be removed.
cocos2d::CCSpriteFrame*spriteFrameByName(charconst*pszName)
Returns an Sprite Frame that was previously added. If the name is not found it will return nil. You should retain the returned copy if you are going to use it.