cocos2d-x  2.2.3-gd2.113-rev1ec524e
Loading...
Searching...
No Matches
CCActionManager Class Reference

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

#include <CCActionManager.h>

Inheritance diagram for CCActionManager:
[legend]
Collaboration diagram for CCActionManager:
[legend]

Public Member Functions

 CCActionManager (void)
 ctor More...
 
 ~CCActionManager (void)
 NA NA. More...
 
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)
 NA. More...
 
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)
 
 CCObject (const CCObject &)
 
CCObjectoperator= (const CCObject &)
 
virtual void encodeWithCoder (DS_Dictionary *)
 
virtual bool canEncode ()
 
CCObjectType getObjType () const
 
virtual int getTag () const
 
virtual void setTag (int nTag)
 
void setObjType (CCObjectType)
 
- 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
 
int m_nTag
 
int m_eObjType
 
unsigned int m_uObjectIdxInArray
 

Additional Inherited Members

- Static Public Member Functions inherited from CCObject
static CCObjectcreateWithCoder (DS_Dictionary *)
 
- 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()

CCActionManager ( void  )

ctor

◆ ~CCActionManager()

~CCActionManager ( void  )

NA NA.

Member Function Documentation

◆ actionAllocWithHashElement()

void actionAllocWithHashElement ( struct _hashElement *  pElement)
protected

◆ addAction()

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'.

◆ deleteHashElement()

void deleteHashElement ( struct _hashElement *  pElement)
protected

◆ getActionByTag()

CCAction * getActionByTag ( unsigned int  tag,
CCObject pTarget 
)

Gets an action given its tag an a target.

Returns
the Action the with the given tag

◆ numberOfRunningActionsInTarget()

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.

◆ pauseAllRunningActions()

CCSet * pauseAllRunningActions ( )

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

◆ pauseTarget()

void pauseTarget ( CCObject pTarget)

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

◆ removeAction()

void removeAction ( CCAction pAction)

Removes an action given an action reference.

◆ removeActionAtIndex()

void removeActionAtIndex ( unsigned int  uIndex,
struct _hashElement *  pElement 
)
protected

◆ removeActionByTag()

void removeActionByTag ( unsigned int  tag,
CCObject pTarget 
)

Removes an action given its tag and the target.

◆ removeAllActions()

void removeAllActions ( void  )

Removes all actions from all the targets.

◆ removeAllActionsFromTarget()

void removeAllActionsFromTarget ( CCObject pTarget)

Removes all actions from a certain target.

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

◆ resumeTarget()

void resumeTarget ( CCObject pTarget)

Resumes the target.

All queued actions will be resumed.

◆ resumeTargets()

void resumeTargets ( CCSet targetsToResume)

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

◆ update()

void update ( float  dt)
protectedvirtual

Reimplemented from CCObject.

Member Data Documentation

◆ m_bCurrentTargetSalvaged

bool m_bCurrentTargetSalvaged
protected

◆ m_pCurrentTarget

struct _hashElement* m_pCurrentTarget
protected

◆ m_pTargets

struct _hashElement* m_pTargets
protected

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