cocos2d-iphone  1.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
CCSpriteFrameCache Class Reference

#import <CCSpriteFrameCache.h>

List of all members.

Public Member Functions

(void) - addSpriteFramesWithDictionary:texture:
(void) - addSpriteFramesWithFile:
(void) - addSpriteFramesWithFile:texture:
(void) - addSpriteFramesWithFile:textureFile:
(void) - addSpriteFrame:name:
(void) - removeSpriteFrames
(void) - removeUnusedSpriteFrames
(void) - removeSpriteFrameByName:
(void) - removeSpriteFramesFromFile:
(void) - removeSpriteFramesFromDictionary:
(void) - removeSpriteFramesFromTexture:
(CCSpriteFrame *) - spriteFrameByName:

Static Public Member Functions

(CCSpriteFrameCache *) + sharedSpriteFrameCache
(void) + purgeSharedSpriteFrameCache

Protected Attributes

NSMutableDictionary * spriteFrames_
NSMutableDictionary * spriteFramesAliases_

Detailed Description

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

Since:
v0.9

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.

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

Since:
v0.99.5

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.

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.

Since:
v0.99.5
- (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.

Since:
v0.99.5

Removes all Sprite Frames associated with the specified textures. It is convinient to call this method when a specific texture needs to be removed.

Since:
v0.995.

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.

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: