cocos2d-x  3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AnimationCache Class Reference

Singleton that manages the Animations. More...

#include <CCAnimationCache.h>

Inheritance diagram for AnimationCache:
Ref

Public Member Functions

 AnimationCache ()
 ctor ()
 AnimationCache ()
 ~AnimationCache ()
bool init (void)
var init ()
local init ()
void addAnimation (Animation *animation, const std::string &name)
 Adds a Animation with a name. More...
 
var addAnimation ( var animation, var name)
 Adds a Animation with a name. More...
 
local addAnimation ( local animation, local name)
 Adds a Animation with a name. More...
 
void removeAnimation (const std::string &name)
 Deletes a Animation from the cache. More...
 
local removeAnimation ( local name)
 Deletes a Animation from the cache. More...
 
void removeAnimationByName (const std::string &name)
AnimationgetAnimation (const std::string &name)
 Returns a Animation that was previously added. More...
 
var getAnimation ( var name)
 Returns a Animation that was previously added. More...
 
local getAnimation ( local name)
 Returns a Animation that was previously added. More...
 
AnimationanimationByName (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. More...
 
void addAnimationsWithFile (const std::string &plist)
 Adds an animation from a plist file. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()

Static Public Member Functions

static AnimationCachegetInstance ()
 Returns the shared instance of the Animation cache. More...
 
var getInstance ()
 Returns the shared instance of the Animation cache. More...
 
local getInstance ()
 Returns the shared instance of the Animation cache. More...
 
static void destroyInstance ()
 Purges the cache. More...
 
local destroyInstance ()
 Purges the cache. More...
 
static AnimationCachesharedAnimationCache ()
var sharedAnimationCache ()
local sharedAnimationCache ()
static void purgeSharedAnimationCache ()
var purgeSharedAnimationCache ()
local purgeSharedAnimationCache ()

Additional Inherited Members

- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

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

Constructor & Destructor Documentation

var ctor ( )
local AnimationCache ( )

Member Function Documentation

void addAnimation ( Animation animation,
const std::string &  name 
)

Adds a Animation with a name.

var addAnimation ( var  animation,
var  name 
)

Adds a Animation with a name.

local addAnimation ( local  animation,
local  name 
)

Adds a Animation with a 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.

Parameters
plistThe path of the relative file,it use to find the plist path for load SpriteFrames.
Since
v1.1
var addAnimationsWithDictionary ( var  dictionary,
var  plist 
)

Adds an animation from an NSDictionary Make sure that the frames were previously loaded in the SpriteFrameCache.

Parameters
plistThe path of the relative file,it use to find the plist path for load SpriteFrames.
Since
v1.1
local addAnimationsWithDictionary ( local  dictionary,
local  plist 
)

Adds an animation from an NSDictionary Make sure that the frames were previously loaded in the SpriteFrameCache.

Parameters
plistThe path of the relative file,it use to find the plist path for load SpriteFrames.
Since
v1.1
void addAnimationsWithFile ( const std::string &  plist)

Adds an animation from a plist file.

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

Since
v1.1
var addAnimations ( var  plist)

Adds an animation from a plist file.

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

Since
v1.1
local addAnimations ( local  plist)

Adds an animation from a plist file.

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

Since
v1.1
Animation* animationByName ( const std::string &  name)
inline
static void destroyInstance ( )
static

Purges the cache.

It releases all the Animation objects and the shared instance.

var destroyInstance ( )
static

Purges the cache.

It releases all the Animation objects and the shared instance.

local destroyInstance ( )
static

Purges the cache.

It releases all the Animation objects and the shared instance.

Animation* getAnimation ( const std::string &  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.

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

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

static AnimationCache* getInstance ( )
static

Returns the shared instance of the Animation cache.

var getInstance ( )
static

Returns the shared instance of the Animation cache.

local getInstance ( )
static

Returns the shared instance of the Animation cache.

bool init ( void  )
var init (   )
local init (   )
static void
purgeSharedAnimationCache
( )
inlinestatic
var purgeSharedAnimationCache ( )
inlinestatic
local purgeSharedAnimationCache ( )
inlinestatic
void removeAnimation ( const std::string &  name)

Deletes a Animation from the cache.

var removeAnimation ( var  name)

Deletes a Animation from the cache.

local removeAnimation ( local  name)

Deletes a Animation from the cache.

void removeAnimationByName ( const std::string &  name)
inline
static AnimationCache*
sharedAnimationCache
( )
inlinestatic
var sharedAnimationCache ( )
inlinestatic
local sharedAnimationCache ( )
inlinestatic

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