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

CCActionManager is a singleton that manages all the actions. More...

#include <CCActionManager.h>

Inheritance diagram for CCActionManager:
CCObject CCCopying

Public Member Functions

 CCActionManager (void)
 ~CCActionManager (void)
void addAction (CCAction *pAction, CCNode *pTarget, bool paused)
 Adds an action with a target. More...
 
void removeAllActions (void)
 Removes all actions from all the targets. More...
 
void removeAllActionsFromTarget (CCObject *pTarget)
 Removes all actions from a certain target. More...
 
void removeAction (CCAction *pAction)
 Removes an action given an action reference. More...
 
void removeActionByTag (unsigned int tag, CCObject *pTarget)
 Removes an action given its tag and the target. More...
 
CCActiongetActionByTag (unsigned int tag, CCObject *pTarget)
 Gets an action given its tag an a target. More...
 
unsigned int numberOfRunningActionsInTarget (CCObject *pTarget)
 Returns the numbers of actions that are running in a certain target. More...
 
void pauseTarget (CCObject *pTarget)
 Pauses the target: all running actions and newly added actions will be paused. More...
 
void resumeTarget (CCObject *pTarget)
 Resumes the target. More...
 
CCSetpauseAllRunningActions ()
 Pauses all running actions, returning a list of targets whose actions were paused. More...
 
void resumeTargets (CCSet *targetsToResume)
 Resume a set of targets (convenience function to reverse a pauseAllRunningActions call) More...
 
- 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)
- Public Member Functions inherited from CCCopying
virtual CCObjectcopyWithZone (CCZone *pZone)

Protected Member Functions

void removeActionAtIndex (unsigned int uIndex, struct _hashElement *pElement)
void deleteHashElement (struct _hashElement *pElement)
void actionAllocWithHashElement (struct _hashElement *pElement)
void update (float dt)

Protected Attributes

struct _hashElement * m_pTargets
struct _hashElement * m_pCurrentTarget
bool m_bCurrentTargetSalvaged
- Protected Attributes inherited from CCObject
unsigned int m_uReference
unsigned int m_uAutoReleaseCount

Additional Inherited Members

- Public Attributes inherited from CCObject
unsigned int m_uID
int m_nLuaID

Detailed Description

CCActionManager is a singleton that manages all the actions.

Normally you won't need to use this singleton directly. 99% of the cases you will use the CCNode interface, which uses this singleton. But there are some cases where you might need to use this singleton. Examples:

  • When you want to run an action where the target is different from a CCNode.
  • When you want to pause / resume the actions
Since
v0.8

Constructor & Destructor Documentation

CCActionManager ( void  )
~CCActionManager ( void  )

Member Function Documentation

void actionAllocWithHashElement ( struct _hashElement *  pElement)
protected
void addAction ( CCAction pAction,
CCNode pTarget,
bool  paused 
)

Adds an action with a target.

If the target is already present, then the action will be added to the existing target. If the target is not present, a new instance of this target will be created either paused or not, and the action will be added to the newly created target. When the target is paused, the queued actions won't be 'ticked'.

void deleteHashElement ( struct _hashElement *  pElement)
protected
CCAction* getActionByTag ( unsigned int  tag,
CCObject pTarget 
)

Gets an action given its tag an a target.

Returns
the Action the with the given tag
unsigned int
numberOfRunningActionsInTarget
( CCObject pTarget)

Returns the numbers of actions that are running in a certain target.

Composable actions are counted as 1 action. Example:

  • If you are running 1 Sequence of 7 actions, it will return 1.
  • If you are running 7 Sequences of 2 actions, it will return 7.
CCSet* pauseAllRunningActions ( )

Pauses all running actions, returning a list of targets whose actions were paused.

void pauseTarget ( CCObject pTarget)

Pauses the target: all running actions and newly added actions will be paused.

void removeAction ( CCAction pAction)

Removes an action given an action reference.

void removeActionAtIndex ( unsigned int  uIndex,
struct _hashElement *  pElement 
)
protected
void removeActionByTag ( unsigned int  tag,
CCObject pTarget 
)

Removes an action given its tag and the target.

void removeAllActions ( void  )

Removes all actions from all the targets.

void removeAllActionsFromTarget ( CCObject pTarget)

Removes all actions from a certain target.

All the actions that belongs to the target will be removed.

void resumeTarget ( CCObject pTarget)

Resumes the target.

All queued actions will be resumed.

void resumeTargets ( CCSet targetsToResume)

Resume a set of targets (convenience function to reverse a pauseAllRunningActions call)

void update ( float  dt)
protectedvirtual

Reimplemented from CCObject.

Member Data Documentation

bool m_bCurrentTargetSalvaged
protected
struct _hashElement*
m_pCurrentTarget
protected
struct _hashElement* m_pTargets
protected

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