Axmol Engine 2.4.0-258ceca
Loading...
Searching...
No Matches
AnimationCache Class Reference

Singleton that manages the Animations. More...

#include <AnimationCache.h>

Public Member Functions

 AnimationCache ()
 @js ctor
 
 ~AnimationCache ()
 @js NA @lua NA
 
void addAnimation (Animation *animation, std::string_view name)
 Adds a Animation with a name.
 
void removeAnimation (std::string_view name)
 Deletes a Animation from the cache.
 
AnimationgetAnimation (std::string_view name)
 Returns a Animation that was previously added.
 
void addAnimationsWithDictionary (const ValueMap &dictionary, std::string_view plist)
 Adds an animation from an NSDictionary.
 
void addAnimationsWithFile (std::string_view plist)
 Adds an animation from a plist file.
 

Static Public Member Functions

static AnimationCachegetInstance ()
 Returns the shared instance of the Animation cache @js NA.
 
static void destroyInstance ()
 Purges the cache.
 

Detailed Description

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.

Since
v0.99.5 @js cc.animationCache

Member Function Documentation

◆ destroyInstance()

static void destroyInstance ( )
static

Purges the cache.

It releases all the Animation objects and the shared instance. @js NA

◆ addAnimation()

void addAnimation ( Animation * animation,
std::string_view name )

Adds a Animation with a name.

Parameters
animationAn animation.
nameThe name of animation.

◆ removeAnimation()

void removeAnimation ( std::string_view name)

Deletes a Animation from the cache.

Parameters
nameThe name of animation.

◆ getAnimation()

Animation * getAnimation ( std::string_view name)

Returns a Animation 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.

Returns
A Animation that was previously added. If the name is not found it will return nil.

◆ addAnimationsWithDictionary()

void addAnimationsWithDictionary ( const ValueMap & dictionary,
std::string_view plist )

Adds an animation from an NSDictionary.

Make sure that the frames were previously loaded in the SpriteFrameCache.

Parameters
dictionaryAn NSDictionary.
plistThe path of the relative file,it use to find the plist path for load SpriteFrames.
Since
v1.1 @js NA

◆ addAnimationsWithFile()

void addAnimationsWithFile ( std::string_view plist)

Adds an animation from a plist file.

Make sure that the frames were previously loaded in the SpriteFrameCache.

Since
v1.1 @js addAnimations @lua addAnimations
Parameters
plistAn animation from a plist file.

The documentation for this class was generated from the following file: