CCSpriteFrameCache Class Reference

#import <CCSpriteFrameCache.h>

List of all members.

Public Member Functions

(void) - addSpriteFramesWithDictionary:texture:
(void) - addSpriteFramesWithFile:
(void) - addSpriteFramesWithFile:texture:
(void) - addSpriteFrame:name:
(void) - removeSpriteFrames
(void) - removeUnusedSpriteFrames
(void) - removeSpriteFrameByName:
(CCSpriteFrame *) - spriteFrameByName:
(CCSprite *) - createSpriteWithFrameName:

Static Public Member Functions

(CCSpriteFrameCache *) + sharedSpriteFrameCache
(void) + purgeSharedSpriteFrameCache

Detailed Description

Singleton that handles the loading of the sprite frames. It saves in a cache the sprite frames.

Since:
v0.9

Definition at line 33 of file CCSpriteFrameCache.h.


Member Function Documentation

- (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.

- (CCSprite*) createSpriteWithFrameName:  

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.

Deprecated:
use [CCSprite spriteWithSpriteFrameName:name]. This method will be removed on final v0.9
+ (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) 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.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Properties Defines

cocos2d for iPhone 0.99.0