Axmol Engine 2.4.0-258ceca
|
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. | |
Animation * | getAnimation (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 AnimationCache * | getInstance () |
Returns the shared instance of the Animation cache @js NA. | |
static void | destroyInstance () |
Purges the cache. | |
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. @js NA
void addAnimation | ( | Animation * | animation, |
std::string_view | name ) |
Adds a Animation with a name.
animation | An animation. |
name | The name of animation. |
void removeAnimation | ( | std::string_view | name | ) |
Deletes a Animation from the cache.
name | The name of animation. |
Animation * getAnimation | ( | std::string_view | name | ) |
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.
dictionary | An NSDictionary. |
plist | The path of the relative file,it use to find the plist path for load SpriteFrames. |
void addAnimationsWithFile | ( | std::string_view | 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. |