cocos2d-x  2.2.6
 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)
 ctor ()
 CCActionManager ()
 ~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...
 
var removeAllActionsFromTarget ( var pTarget)
 Removes all actions from a certain target. More...
 
local removeAllActionsFromTarget ( local 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...
 
var removeActionByTag ( var tag, var pTarget)
 Removes an action given its tag and the target. More...
 
local removeActionByTag ( local tag, local 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...
 
local getActionByTag ( local tag, local 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...
 
local resumeTargets ( local 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)
var deleteHashElement ( var pElement)
local deleteHashElement ( local pElement)
void actionAllocWithHashElement (struct _hashElement *pElement)
local actionAllocWithHashElement ( local pElement)
void update (float dt)
var update ( var dt)
local update ( local dt)

Protected Attributes

struct _hashElement * m_pTargets
struct _hashElement * m_pCurrentTarget
var m_pCurrentTarget
local m_pCurrentTarget
bool m_bCurrentTargetSalvaged
var m_bCurrentTargetSalvaged
local 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  )
var ctor (   )
local CCActionManager (   )
~CCActionManager ( void  )

Member Function Documentation

void actionAllocWithHashElement ( struct _hashElement *  pElement)
protected
var actionAllocWithHashElement ( var  pElement)
protected
local actionAllocWithHashElement ( local  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'.

var addAction ( var  pAction,
var  pTarget,
var  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'.

local addAction ( local  pAction,
local  pTarget,
local  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
var deleteHashElement ( var  pElement)
protected
local deleteHashElement ( local  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
var getActionByTag ( var  tag,
var  pTarget 
)

Gets an action given its tag an a target.

Returns
the Action the with the given tag
local getActionByTag ( local  tag,
local  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.
var numberOfRunningActionsInTarget ( var  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.
local
numberOfRunningActionsInTarget
( local  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.

var pauseAllRunningActions ( )

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

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

var pauseTarget ( var  pTarget)

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

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

var removeAction ( var  pAction)

Removes an action given an action reference.

local removeAction ( local  pAction)

Removes an action given an action reference.

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

Removes an action given its tag and the target.

var removeActionByTag ( var  tag,
var  pTarget 
)

Removes an action given its tag and the target.

local removeActionByTag ( local  tag,
local  pTarget 
)

Removes an action given its tag and the target.

void removeAllActions ( void  )

Removes all actions from all the targets.

var removeAllActions (   )

Removes all actions from all the targets.

local removeAllActions (   )

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.

var removeAllActionsFromTarget ( var  pTarget)

Removes all actions from a certain target.

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

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

var resumeTarget ( var  pTarget)

Resumes the target.

All queued actions will be resumed.

local resumeTarget ( local  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)

var resumeTargets ( var  targetsToResume)

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

local resumeTargets ( local  targetsToResume)

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

void update ( float  dt)
protectedvirtual

Reimplemented from CCObject.

var update ( var  dt)
protectedvirtual

Reimplemented from CCObject.

local update ( local  dt)
protectedvirtual

Reimplemented from CCObject.

Member Data Documentation

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

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