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

Singleton that manages the Animations. More...

#include <CCAnimationCache.h>

Inheritance diagram for CCAnimationCache:
CCObject CCCopying

Public Member Functions

 CCAnimationCache ()
 ~CCAnimationCache ()
void addAnimation (CCAnimation *animation, const char *name)
 Adds a CCAnimation with a name. More...
 
void removeAnimationByName (const char *name)
 Deletes a CCAnimation from the cache. More...
 
CCAnimationanimationByName (const char *name)
 Returns a CCAnimation that was previously added. More...
 
void addAnimationsWithDictionary (CCDictionary *dictionary, const char *plist=NULL)
 Adds an animation from an NSDictionary Make sure that the frames were previously loaded in the CCSpriteFrameCache. More...
 
void addAnimationsWithFile (const char *plist)
 Adds an animation from a plist file. More...
 
bool init (void)
- Public Member Functions inherited from CCObject
 CCObject (void)
virtual ~CCObject (void)
void release (void)
void retain (void)
CCObjectautorelease (void)
CCObjectcopy (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)
- Public Member Functions inherited from CCCopying
virtual CCObjectcopyWithZone (CCZone *pZone)

Static Public Member Functions

static CCAnimationCachesharedAnimationCache (void)
 Returns the shared instance of the Animation cache. More...
 
local sharedAnimationCache ()
 Returns the shared instance of the Animation cache. More...
 
static void purgeSharedAnimationCache (void)
 Purges the cache. More...
 

Additional Inherited Members

- Public Attributes inherited from CCObject
unsigned int m_uID
int m_nLuaID
- Protected Attributes inherited from CCObject
unsigned int m_uReference
unsigned int m_uAutoReleaseCount

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 CCSprite. Since v0.99.5, you should use this class instead.

Since
v0.99.5

Constructor & Destructor Documentation

var ctor ( )
local CCAnimationCache ( )

Member Function Documentation

void addAnimation ( CCAnimation animation,
const char *  name 
)

Adds a CCAnimation with a name.

var addAnimation ( var  animation,
var  name 
)

Adds a CCAnimation with a name.

local addAnimation ( local  animation,
local  name 
)

Adds a CCAnimation with a name.

void addAnimationsWithDictionary ( CCDictionary dictionary,
const char *  plist = NULL 
)

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

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 = NULL 
)

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

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 = NULL 
)

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

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

Adds an animation from a plist file.

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

Since
v1.1
var addAnimations ( var  plist)

Adds an animation from a plist file.

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

Since
v1.1
local addAnimationsWithFile ( local  plist)

Adds an animation from a plist file.

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

Since
v1.1
CCAnimation* animationByName ( const char *  name)

Returns a CCAnimation 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 CCAnimation 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 animationByName ( local  name)

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

bool init ( void  )
var init (   )
local init (   )
static void
purgeSharedAnimationCache
( void  )
static

Purges the cache.

It releases all the CCAnimation objects and the shared instance.

var purgeSharedAnimationCache (   )
static

Purges the cache.

It releases all the CCAnimation objects and the shared instance.

local purgeSharedAnimationCache (   )
static

Purges the cache.

It releases all the CCAnimation objects and the shared instance.

void removeAnimationByName ( const char *  name)

Deletes a CCAnimation from the cache.

var removeAnimation ( var  name)

Deletes a CCAnimation from the cache.

local removeAnimationByName ( local  name)

Deletes a CCAnimation from the cache.

static CCAnimationCache*
sharedAnimationCache
( void  )
static

Returns the shared instance of the Animation cache.

var getInstance (   )
static

Returns the shared instance of the Animation cache.

local sharedAnimationCache (   )
static

Returns the shared instance of the Animation cache.


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