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

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

#include <CCActionManager.h>

Inheritance diagram for ActionManager:
Ref

Public Member Functions

 ActionManager (void)
 ctor More...
 
 ~ActionManager (void)
 NA NA More...
 
void addAction (Action *action, Node *target, bool paused)
 Adds an action with a target. More...
 
void removeAllActions ()
 Removes all actions from all the targets. More...
 
void removeAllActionsFromTarget (Node *target)
 Removes all actions from a certain target. More...
 
void removeAction (Action *action)
 Removes an action given an action reference. More...
 
void removeActionByTag (int tag, Node *target)
 Removes an action given its tag and the target. More...
 
void removeAllActionsByTag (int tag, Node *target)
 Removes all actions given its tag and the target. More...
 
ActiongetActionByTag (int tag, const Node *target) const
 Gets an action given its tag an a target. More...
 
ssize_t getNumberOfRunningActionsInTarget (const Node *target) const
 Returns the numbers of actions that are running in a certain target. More...
 
ssize_t numberOfRunningActionsInTarget (Node *target) const
 
void pauseTarget (Node *target)
 Pauses the target: all running actions and newly added actions will be paused. More...
 
void resumeTarget (Node *target)
 Resumes the target. More...
 
Vector< Node * > pauseAllRunningActions ()
 Pauses all running actions, returning a list of targets whose actions were paused. More...
 
void resumeTargets (const Vector< Node * > &targetsToResume)
 Resume a set of targets (convenience function to reverse a pauseAllRunningActions call) More...
 
void update (float dt)
 
- 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 ()
 NA NA More...
 

Protected Member Functions

void removeActionAtIndex (ssize_t index, struct _hashElement *element)
 
void deleteHashElement (struct _hashElement *element)
 
void actionAllocWithHashElement (struct _hashElement *element)
 
- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 

Protected Attributes

struct _hashElement * _targets
 
struct _hashElement * _currentTarget
 
bool _currentTargetSalvaged
 
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Detailed Description

ActionManager 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 Node 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 Node.
  • When you want to pause / resume the actions
Since
v0.8

Constructor & Destructor Documentation

ActionManager ( void  )

ctor

~ActionManager ( void  )

NA NA

Member Function Documentation

void actionAllocWithHashElement ( struct _hashElement *  element)
protected
void addAction ( Action action,
Node target,
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 *  element)
protected
Action* getActionByTag ( int  tag,
const Node target 
) const

Gets an action given its tag an a target.

Returns
the Action the with the given tag
ssize_t getNumberOfRunningActionsInTarget ( const Node target) const

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.
ssize_t numberOfRunningActionsInTarget ( Node target) const
inline
Vector<Node*> pauseAllRunningActions ( )

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

void pauseTarget ( Node target)

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

void removeAction ( Action action)

Removes an action given an action reference.

void removeActionAtIndex ( ssize_t  index,
struct _hashElement *  element 
)
protected
void removeActionByTag ( int  tag,
Node target 
)

Removes an action given its tag and the target.

void removeAllActions ( )

Removes all actions from all the targets.

void removeAllActionsByTag ( int  tag,
Node target 
)

Removes all actions given its tag and the target.

void removeAllActionsFromTarget ( Node target)

Removes all actions from a certain target.

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

void resumeTarget ( Node target)

Resumes the target.

All queued actions will be resumed.

void resumeTargets ( const Vector< Node * > &  targetsToResume)

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

void update ( float  dt)

Member Data Documentation

struct _hashElement* _currentTarget
protected
bool _currentTargetSalvaged
protected
struct _hashElement* _targets
protected

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