#import "CCSpriteFrameCache.h"
Public Member Functions | |
(void) | - addSpriteFrame:name: |
(void) | - addSpriteFramesWithDictionary:texture: |
(void) | - addSpriteFramesWithFile: |
(void) | - addSpriteFramesWithFile:texture: |
(void) | - addSpriteFramesWithFile:textureFile: |
(CCSprite *) | - createSpriteWithFrameName: |
(void) | - removeSpriteFrameByName: |
(void) | - removeSpriteFrames |
(void) | - removeSpriteFramesFromDictionary: |
(void) | - removeSpriteFramesFromFile: |
(void) | - removeSpriteFramesFromTexture: |
(void) | - removeUnusedSpriteFrames |
(CCSpriteFrame *) | - spriteFrameByName: |
Static Public Member Functions | |
(void) | + purgeSharedSpriteFrameCache |
(CCSpriteFrameCache *) | + sharedSpriteFrameCache |
Singleton that handles the loading of the sprite frames. It saves in a cache the sprite frames.
- (void) addSpriteFrame: | (CCSpriteFrame *) | frame | ||
name: | (NSString *) | frameName | ||
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.
- (void) addSpriteFramesWithDictionary: | (NSDictionary *) | dictionary | ||
texture: | (CCTexture2D *) | texture | ||
Adds multiple Sprite Frames with a dictionary. The texture will be associated with the created sprite frames.
- (void) addSpriteFramesWithFile: | (NSString *) | plist |
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.
- (void) addSpriteFramesWithFile: | (NSString *) | plist | ||
texture: | (CCTexture2D *) | texture | ||
Adds multiple Sprite Frames from a plist file. The texture will be associated with the created sprite frames.
- (void) addSpriteFramesWithFile: | (NSString *) | plist | ||
textureFile: | (NSString *) | textureFileName | ||
Adds multiple Sprite Frames from a plist file. The texture will be associated with the created sprite frames.
- (CCSprite*) createSpriteWithFrameName: | (NSString *) | DEPRECATED_ATTRIBUTE |
Creates an sprite with the name of an sprite frame. The created sprite will contain the texture, rect and offset of the sprite frame. It returns an autorelease object.
+ (void) purgeSharedSpriteFrameCache |
Purges the cache. It releases all the Sprite Frames and the retained instance.
- (void) removeSpriteFrameByName: | (NSString *) | name |
Deletes an sprite frame from the sprite frame cache.
- (void) removeSpriteFrames |
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.
- (void) removeSpriteFramesFromDictionary: | (NSDictionary *) | dictionary |
Removes multiple Sprite Frames from NSDictionary.
- (void) removeSpriteFramesFromFile: | (NSString *) | plist |
Removes multiple Sprite Frames from a plist file. Sprite Frames stored in this file will be removed. It is convinient to call this method when a specific texture needs to be removed.
- (void) removeSpriteFramesFromTexture: | (CCTexture2D *) | texture |
Removes all Sprite Frames associated with the specified textures. It is convinient to call this method when a specific texture needs to be removed.
- (void) removeUnusedSpriteFrames |
Removes unused sprite frames. Sprite Frames that have a retain count of 1 will be deleted. It is convinient to call this method after when starting a new Scene.
+ (CCSpriteFrameCache *) sharedSpriteFrameCache |
Retruns ths shared instance of the Sprite Frame cache
- (CCSpriteFrame*) spriteFrameByName: | (NSString *) | name |
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.