cocos2d-x
2.2.3-gd2.113-rev1ec524e
|
Singleton that handles the loading of the sprite frames. More...
#include <CCSpriteFrameCache.h>
Public Member Functions | |
bool | init (void) |
~CCSpriteFrameCache (void) | |
NA NA. More... | |
void | addSpriteFramesWithFile (const char *pszPlist) |
Adds multiple Sprite Frames from a plist file. More... | |
void | addSpriteFramesWithFile (const char *plist, const char *textureFileName) |
Adds multiple Sprite Frames from a plist file. More... | |
void | addSpriteFramesWithFile (const char *pszPlist, CCTexture2D *pobTexture) |
Adds multiple Sprite Frames from a plist file. More... | |
void | addSpriteFrame (CCSpriteFrame *pobFrame, const char *pszFrameName) |
Adds an sprite frame with a given name. More... | |
void | removeSpriteFrames (void) |
Purges the dictionary of loaded sprite frames. More... | |
void | removeUnusedSpriteFrames (void) |
Removes unused sprite frames. More... | |
void | removeSpriteFrameByName (const char *pszName) |
Deletes an sprite frame from the sprite frame cache. More... | |
void | removeSpriteFramesFromFile (const char *plist) |
Removes multiple Sprite Frames from a plist file. More... | |
void | removeSpriteFramesFromTexture (CCTexture2D *texture) |
Removes all Sprite Frames associated with the specified textures. More... | |
CCSpriteFrame * | spriteFrameByName (const char *pszName) |
Returns an Sprite Frame that was previously added. More... | |
![]() | |
CCObject (void) | |
virtual | ~CCObject (void) |
NA. More... | |
void | release (void) |
void | retain (void) |
CCObject * | autorelease (void) |
CCObject * | copy (void) |
bool | isSingleReference (void) const |
unsigned int | retainCount (void) const |
virtual bool | isEqual (const CCObject *pObject) |
virtual void | acceptVisitor (CCDataVisitor &visitor) |
virtual void | update (float dt) |
CCObject (const CCObject &) | |
CCObject & | operator= (const CCObject &) |
virtual void | encodeWithCoder (DS_Dictionary *) |
virtual bool | canEncode () |
CCObjectType | getObjType () const |
virtual int | getTag () const |
virtual void | setTag (int nTag) |
void | setObjType (CCObjectType) |
![]() | |
virtual CCObject * | copyWithZone (CCZone *pZone) |
Static Public Member Functions | |
static CCSpriteFrameCache * | sharedSpriteFrameCache (void) |
Returns the shared instance of the Sprite Frame cache getInstance. More... | |
static void | purgeSharedSpriteFrameCache (void) |
Purges the cache. More... | |
![]() | |
static CCObject * | createWithCoder (DS_Dictionary *) |
Protected Member Functions | |
CCSpriteFrameCache (void) | |
ctor More... | |
Protected Attributes | |
CCDictionary * | m_pSpriteFrames |
CCDictionary * | m_pSpriteFramesAliases |
std::set< std::string > * | m_pLoadedFileNames |
![]() | |
unsigned int | m_uReference |
unsigned int | m_uAutoReleaseCount |
int | m_nTag |
int | m_eObjType |
unsigned int | m_uObjectIdxInArray |
Additional Inherited Members | |
![]() | |
unsigned int | m_uID |
int | m_nLuaID |
Singleton that handles the loading of the sprite frames.
It saves in a cache the sprite frames.
|
inlineprotected |
ctor
~CCSpriteFrameCache | ( | void | ) |
NA NA.
void addSpriteFrame | ( | CCSpriteFrame * | pobFrame, |
const char * | 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.
void addSpriteFramesWithFile | ( | const char * | plist, |
const char * | textureFileName | ||
) |
Adds multiple Sprite Frames from a plist file.
The texture will be associated with the created sprite frames.
void addSpriteFramesWithFile | ( | const char * | 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. addSpriteFrames
void addSpriteFramesWithFile | ( | const char * | pszPlist, |
CCTexture2D * | pobTexture | ||
) |
Adds multiple Sprite Frames from a plist file.
The texture will be associated with the created sprite frames. addSpriteFrames
bool init | ( | void | ) |
|
static |
Purges the cache.
It releases all the Sprite Frames and the retained instance.
void removeSpriteFrameByName | ( | const char * | pszName | ) |
Deletes an sprite frame from the sprite frame cache.
getSpriteFrame
void removeSpriteFrames | ( | void | ) |
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 removeSpriteFramesFromFile | ( | const char * | 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.
void removeSpriteFramesFromTexture | ( | 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.
void removeUnusedSpriteFrames | ( | void | ) |
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.
|
static |
Returns the shared instance of the Sprite Frame cache getInstance.
CCSpriteFrame * spriteFrameByName | ( | const char * | 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. getSpriteFrame
|
protected |
|
protected |
|
protected |