Cocos2d-x
4.0.0
|
Singleton that manages the Animations. More...
Inherits Ref.
Public Member Functions | |
AnimationCache () | |
ctor | |
~AnimationCache () | |
NA NA | |
void | addAnimation (Animation *animation, const std::string &name) |
Adds a Animation with a name. | |
void | removeAnimation (const std::string &name) |
Deletes a Animation from the cache. | |
Animation * | getAnimation (const std::string &name) |
Returns a Animation that was previously added. | |
void | addAnimationsWithDictionary (const ValueMap &dictionary, const std::string &plist) |
Adds an animation from an NSDictionary. | |
void | addAnimationsWithFile (const std::string &plist) |
Adds an animation from a plist file. | |
![]() | |
void | retain () |
Retains the ownership. | |
void | release () |
Releases the ownership immediately. | |
Ref * | autorelease () |
Releases the ownership sometime soon automatically. | |
unsigned int | getReferenceCount () const |
Returns the Ref's current reference count. | |
virtual | ~Ref () |
Destructor. | |
Static Public Member Functions | |
static AnimationCache * | getInstance () |
Returns the shared instance of the Animation cache NA. | |
static void | destroyInstance () |
Purges the cache. | |
Additional Inherited Members | |
![]() | |
unsigned int | _ID |
object id, ScriptSupport need public _ID | |
int | _luaID |
Lua reference id. | |
void * | _scriptObject |
scriptObject, support for swift | |
bool | _rooted |
When true, it means that the object was already rooted. | |
Singleton that manages the Animations.
It saves in a cache the animations. You should use this class if you want to save your animations in a cache.
Before v0.99.5, the recommend way was to save them on the Sprite. Since v0.99.5, you should use this class instead.
|
static |
Purges the cache.
It releases all the Animation objects and the shared instance. NA
void addAnimation | ( | Animation * | animation, |
const std::string & | name | ||
) |
Adds a Animation with a name.
animation | An animation. |
name | The name of animation. |
void removeAnimation | ( | const std::string & | name | ) |
Deletes a Animation from the cache.
name | The name of animation. |
Animation* getAnimation | ( | const std::string & | name | ) |
void addAnimationsWithDictionary | ( | const ValueMap & | dictionary, |
const std::string & | plist | ||
) |
Adds an animation from an NSDictionary.
Make sure that the frames were previously loaded in the SpriteFrameCache.
dictionary | An NSDictionary. |
plist | The path of the relative file,it use to find the plist path for load SpriteFrames. |
void addAnimationsWithFile | ( | const std::string & | plist | ) |
Adds an animation from a plist file.
Make sure that the frames were previously loaded in the SpriteFrameCache.
plist | An animation from a plist file. |