cocos2d-x  3.0-alpha0
 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:
Object

Public Member Functions

 ActionManager (void)
 ~ActionManager (void)
void addAction (Action *pAction, Node *target, bool paused)
 Adds an action with a target. More...
 
void removeAllActions (void)
 Removes all actions from all the targets. More...
 
void removeAllActionsFromTarget (Object *target)
 Removes all actions from a certain target. More...
 
void removeAction (Action *pAction)
 Removes an action given an action reference. More...
 
void removeActionByTag (int tag, Object *target)
 Removes an action given its tag and the target. More...
 
ActiongetActionByTag (int tag, const Object *target) const
 Gets an action given its tag an a target. More...
 
unsigned int getNumberOfRunningActionsInTarget (const Object *target) const
 Returns the numbers of actions that are running in a certain target. More...
 
local getNumberOfRunningActionsInTarget ( local target)
 Returns the numbers of actions that are running in a certain target. More...
 
CC_DEPRECATED_ATTRIBUTE
unsigned int 
numberOfRunningActionsInTarget (Object *target) const
local numberOfRunningActionsInTarget ( local target)
void pauseTarget (Object *target)
 Pauses the target: all running actions and newly added actions will be paused. More...
 
void resumeTarget (Object *target)
 Resumes the target. More...
 
SetpauseAllRunningActions ()
 Pauses all running actions, returning a list of targets whose actions were paused. More...
 
void resumeTargets (Set *targetsToResume)
 Resume a set of targets (convenience function to reverse a pauseAllRunningActions call) More...
 
- Public Member Functions inherited from Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
void release ()
 Release the ownership immediately. More...
 
void retain ()
 Retains the ownership. More...
 
Objectautorelease ()
 Release the ownership sometime soon automatically. More...
 
bool isSingleReference () const
 Returns a boolean value that indicates whether there is only one reference to the object. More...
 
unsigned int retainCount () const
 Returns the object's current reference count. More...
 
virtual bool isEqual (const Object *object)
 Returns a boolean value that indicates whether this object and a given object are equal. More...
 
virtual void acceptVisitor (DataVisitor &visitor)

Protected Member Functions

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

Protected Attributes

struct _hashElement * _targets
struct _hashElement * _currentTarget
var _currentTarget
local _currentTarget
bool _currentTargetSalvaged
var _currentTargetSalvaged
local _currentTargetSalvaged
- Protected Attributes inherited from Object
unsigned int _reference
 count of references More...
 
var _reference
 count of references More...
 
local _reference
 count of references More...
 
unsigned int _autoReleaseCount
 count of autorelease More...
 
var _autoReleaseCount
 count of autorelease More...
 
local _autoReleaseCount
 count of autorelease More...
 

Additional Inherited Members

- Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. 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  )
var ctor (   )
local ActionManager (   )
~ActionManager ( void  )

Member Function Documentation

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

var addAction ( var  pAction,
var  target,
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  target,
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
Action* getActionByTag ( int  tag,
const Object target 
) const

Gets an action given its tag an a target.

Returns
the Action the with the given tag
var getActionByTag ( var  tag,
var  target 
)

Gets an action given its tag an a target.

Returns
the Action the with the given tag
local getActionByTag ( local  tag,
local  target 
)

Gets an action given its tag an a target.

Returns
the Action the with the given tag
unsigned int
getNumberOfRunningActionsInTarget
( const Object 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.
var
getNumberOfRunningActionsInTarget
( var  target)

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
getNumberOfRunningActionsInTarget
( local  target)

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.
CC_DEPRECATED_ATTRIBUTE
unsigned int
numberOfRunningActionsInTarget
( Object target) const
inline
var numberOfRunningActionsInTarget ( var  target)
inline
local
numberOfRunningActionsInTarget
( local  target)
inline
Set* 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 ( Object target)

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

var pauseTarget ( var  target)

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

local pauseTarget ( local  target)

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

void removeAction ( Action 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 ( int  index,
struct _hashElement *  pElement 
)
protected
var removeActionAtIndex ( var  index,
var  pElement 
)
protected
local removeActionAtIndex ( local  index,
local  pElement 
)
protected
void removeActionByTag ( int  tag,
Object target 
)

Removes an action given its tag and the target.

var removeActionByTag ( var  tag,
var  target 
)

Removes an action given its tag and the target.

local removeActionByTag ( local  tag,
local  target 
)

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 ( Object target)

Removes all actions from a certain target.

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

var removeAllActionsFromTarget ( var  target)

Removes all actions from a certain target.

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

local removeAllActionsFromTarget ( local  target)

Removes all actions from a certain target.

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

void resumeTarget ( Object target)

Resumes the target.

All queued actions will be resumed.

var resumeTarget ( var  target)

Resumes the target.

All queued actions will be resumed.

local resumeTarget ( local  target)

Resumes the target.

All queued actions will be resumed.

void resumeTargets ( Set 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 Object.

var update ( var  dt)
protectedvirtual

Reimplemented from Object.

local update ( local  dt)
protectedvirtual

Reimplemented from Object.

Member Data Documentation

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

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