Cocos2d-x  v3.11
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
ActionManager Class Reference

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

Inherits Ref.

Public Member Functions

void addAction (Action *action, Node *target, bool paused)
 Adds an action with a target. More...
 
void removeAllActions ()
 Removes all actions from all the targets.
 
void removeAllActionsFromTarget (Node *target)
 Removes all actions from a certain target. More...
 
var removeAllActionsFromTarget ( var target)
 Removes all actions from a certain target. More...
 
local removeAllActionsFromTarget ( local 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...
 
var removeActionByTag ( var tag, var target)
 Removes an action given its tag and the target. More...
 
local removeActionByTag ( local tag, local 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...
 
local removeAllActionsByTag ( local tag, local target)
 Removes all actions given its tag and the target. More...
 
void removeActionsByFlags (unsigned int flags, Node *target)
 Removes all actions matching at least one bit in flags and the target. More...
 
Action * getActionByTag (int tag, const Node *target) const
 Gets an action given its tag an a target. More...
 
var getActionByTag ( var tag, var target)
 Gets an action given its tag an a target. More...
 
local getActionByTag ( local tag, local target)
 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
local numberOfRunningActionsInTarget ( local target)
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...
 
var resumeTargets ( var 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...
 
void update (float dt)
 Main loop of ActionManager. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
local 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...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor.
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 
bool _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 
local _scriptOwned
 The life of the object is scrolled by the scripting engine. 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.

Member Function Documentation

void addAction ( Action *  action,
Node target,
bool  paused 
)

Adds an action with a target.

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

An action to be added. The target which need to be added an action. Is the target paused or not.

var addAction ( var  action,
var  target,
var  paused 
)

Adds an action with a target.

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

An action to be added. The target which need to be added an action. Is the target paused or not.

local addAction ( local  action,
local  target,
local  paused 
)

Adds an action with a target.

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

An action to be added. The target which need to be added an action. Is the target paused or not.

void removeAllActionsFromTarget ( Node target)

Removes all actions from a certain target.

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

A certain target.

var removeAllActionsFromTarget ( var  target)

Removes all actions from a certain target.

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

A certain target.

local removeAllActionsFromTarget ( local  target)

Removes all actions from a certain target.

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

A certain target.

void removeAction ( Action *  action)

Removes an action given an action reference.

A certain action.

var removeAction ( var  action)

Removes an action given an action reference.

A certain action.

local removeAction ( local  action)

Removes an action given an action reference.

A certain action.

void removeActionByTag ( int  tag,
Node target 
)

Removes an action given its tag and the target.

The action's tag. A certain target.

var removeActionByTag ( var  tag,
var  target 
)

Removes an action given its tag and the target.

The action's tag. A certain target.

local removeActionByTag ( local  tag,
local  target 
)

Removes an action given its tag and the target.

The action's tag. A certain target.

void removeAllActionsByTag ( int  tag,
Node target 
)

Removes all actions given its tag and the target.

The actions' tag. A certain target.

local removeAllActionsByTag ( local  tag,
local  target 
)

Removes all actions given its tag and the target.

The actions' tag. A certain target.

void removeActionsByFlags ( unsigned int  flags,
Node target 
)

Removes all actions matching at least one bit in flags and the target.

Parameters
flagsThe flag field to match the actions' flags based on bitwise AND.
targetA certain target.
local removeActionsByFlags ( local  flags,
local  target 
)

Removes all actions matching at least one bit in flags and the target.

Parameters
flagsThe flag field to match the actions' flags based on bitwise AND.
targetA certain target.
Action* getActionByTag ( int  tag,
const Node target 
) const

Gets an action given its tag an a target.

The action's tag. A certain target. The Action the with the given tag.

var getActionByTag ( var  tag,
var  target 
)

Gets an action given its tag an a target.

The action's tag. A certain target. The Action the with the given tag.

local getActionByTag ( local  tag,
local  target 
)

Gets an action given its tag an a target.

The action's tag. A certain target. 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.

    A certain target. The numbers of actions that are running in a certain target.

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.

    A certain target. The numbers of actions that are running in a certain target.

ssize_t
numberOfRunningActionsInTarget
( Node target) const
inline
var numberOfRunningActionsInTarget ( var  target)
inline
local
numberOfRunningActionsInTarget
( local  target)
inline
void pauseTarget ( Node target)

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

A certain target.

var pauseTarget ( var  target)

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

A certain target.

local pauseTarget ( local  target)

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

A certain target.

void resumeTarget ( Node target)

Resumes the target.

All queued actions will be resumed.

A certain target.

var resumeTarget ( var  target)

Resumes the target.

All queued actions will be resumed.

A certain target.

local resumeTarget ( local  target)

Resumes the target.

All queued actions will be resumed.

A certain target.

Vector<Node*>
pauseAllRunningActions
( )

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

A list of targets whose actions were paused.

var pauseAllRunningActions ( )

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

A list of targets whose actions were paused.

local pauseAllRunningActions ( )

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

A list of targets whose actions were paused.

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

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

A set of targets need to be resumed.

var resumeTargets ( var  targetsToResume)

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

A set of targets need to be resumed.

local resumeTargets ( local  targetsToResume)

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

A set of targets need to be resumed.

void update ( float  dt)

Main loop of ActionManager.

Interval in seconds.

var update ( var  dt)

Main loop of ActionManager.

Interval in seconds.

local update ( local  dt)

Main loop of ActionManager.

Interval in seconds.


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