nomlib
Loading...
Searching...
No Matches
nom::SequenceAction Class Reference

Run a collection of actions sequentially. More...

#include <SequenceAction.hpp>

Inheritance diagram for nom::SequenceAction:
[legend]

Public Types

typedef SequenceAction self_type
typedef IActionObject derived_type
Public Types inherited from nom::IActionObject
enum  FrameState { COMPLETED , PLAYING }
 The update status of the action. More...
typedef IActionObject self_type
typedef std::function< real32(real32, real32, real32, real32)> timing_curve_func
 A function pointer to a timing mode.

Public Member Functions

 SequenceAction (const action_list &actions)
 Run a collection of actions sequentially.
virtual std::unique_ptr< IActionObject > clone () const override
 Create a deep copy instance of the action.
virtual IActionObject::FrameState next_frame (real32 delta_time) override
 Play the action forward in time by one time step.
virtual IActionObject::FrameState prev_frame (real32 delta_time) override
 Play the action backwards in time by one time step.
virtual void pause (real32 delta_time) override
 Freeze the action's internal state.
virtual void resume (real32 delta_time) override
 Resume the internal state of the action.
virtual void rewind (real32 delta_time) override
 Reset the internal state of the action back to its initial starting values.
virtual void release () override
 Free externally referenced resources held by the action.
virtual void set_speed (real32 speed) override
 Set the speed factor of the child actions.
virtual void set_timing_curve (const IActionObject::timing_curve_func &mode) override
 Set the timing mode of the child actions.
Public Member Functions inherited from nom::IActionObject
const std::string & name () const
 Get the unique identifier of the action.
real32 duration () const
 Get the duration of the action.
real32 speed () const
 Get the speed modifier of the action.
const IActionObject::timing_curve_functiming_curve () const
 Get the timing mode function used by the action.
void set_name (const std::string &action_id)
 Set the unique identifier of the action.

Private Types

typedef std::vector< std::shared_ptr< IActionObject > > container_type
typedef container_type::iterator container_iterator

Private Member Functions

IActionObject::FrameState update (real32 delta_time, uint32 direction)
const container_type & actions () const

Private Attributes

container_type actions_
 The child actions.
container_iterator actions_iterator_
nom::size_type num_completed_
 The total number of completed actions.
nom::size_type num_actions_
 The total number of actions at the time of construction.

Static Private Attributes

static const char * DEBUG_CLASS_NAME

Friends

class ActionTest
 Allow access into our private parts for unit testing.

Additional Inherited Members

Protected Member Functions inherited from nom::IActionObject
IActionObject::FrameState status () const
 Get the current state of the action.
void set_duration (real32 seconds)
 Set the duration of the action.
void set_status (FrameState state)
 Set the state of the action.
Protected Attributes inherited from nom::IActionObject
real32 elapsed_frames_ = 0.0f
 Internal frames counter.
Timer timer_
 Internal time clock (milliseconds resolution).

Detailed Description

Run a collection of actions sequentially.

This action acts on behalf of other actions as a proxy, running actions to completion, one at a time, before iterating to the next action, in FIFO order. The total duration of the sequence action is the sum of every action's durations in the sequence.

Remarks
This action is not reversible, but the child actions may be reversible. Consult the documentation for the action in question for implementation details.
Note
Sequence actions are particularly useful for transition-style animations.
See also
nom::WaitForDurationAction, nom::GroupAction

Definition at line 41 of file SequenceAction.hpp.

Member Typedef Documentation

◆ container_iterator

typedef container_type::iterator nom::SequenceAction::container_iterator
private

Definition at line 92 of file SequenceAction.hpp.

◆ container_type

typedef std::vector<std::shared_ptr<IActionObject> > nom::SequenceAction::container_type
private

Definition at line 91 of file SequenceAction.hpp.

◆ derived_type

typedef IActionObject nom::SequenceAction::derived_type

Definition at line 48 of file SequenceAction.hpp.

◆ self_type

typedef SequenceAction nom::SequenceAction::self_type

Definition at line 47 of file SequenceAction.hpp.

Constructor & Destructor Documentation

◆ SequenceAction()

nom::SequenceAction::SequenceAction ( const action_list & actions)

Run a collection of actions sequentially.

Parameters
actionsThe group of actions to execute; NULL actions are valid.

Member Function Documentation

◆ clone()

virtual std::unique_ptr< IActionObject > nom::SequenceAction::clone ( ) const
overridevirtual

Create a deep copy instance of the action.

Remarks
A cloned instance is created using the action's attributes at the time of construction. External resources of the action – i.e.: nom::Sprite – are not modified, and you may need to reset the state appropriately if the action has been ran previously.

Implements nom::IActionObject.

◆ next_frame()

virtual IActionObject::FrameState nom::SequenceAction::next_frame ( real32 delta_time)
overridevirtual

Play the action forward in time by one time step.

Parameters
delta_timeReserved for application-defined implementations.
Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
See also
nom::DispatchQueue

Implements nom::IActionObject.

◆ pause()

virtual void nom::SequenceAction::pause ( real32 delta_time)
overridevirtual

Freeze the action's internal state.

Parameters
delta_timeReserved for application-defined implementations.
Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
See also
nom::DispatchQueue

Implements nom::IActionObject.

◆ prev_frame()

virtual IActionObject::FrameState nom::SequenceAction::prev_frame ( real32 delta_time)
overridevirtual

Play the action backwards in time by one time step.

Parameters
delta_timeReserved for application-defined implementations.
Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
Remarks
Not all actions are reversible – see the action's documentation for its implementation details.
See also
nom::ReversedAction

Implements nom::IActionObject.

◆ release()

virtual void nom::SequenceAction::release ( )
overridevirtual

Free externally referenced resources held by the action.

Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
See also
nom::RemoveAction

Implements nom::IActionObject.

◆ resume()

virtual void nom::SequenceAction::resume ( real32 delta_time)
overridevirtual

Resume the internal state of the action.

Parameters
delta_timeReserved for application-defined implementations.
Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
See also
nom::DispatchQueue

Implements nom::IActionObject.

◆ rewind()

virtual void nom::SequenceAction::rewind ( real32 delta_time)
overridevirtual

Reset the internal state of the action back to its initial starting values.

Parameters
delta_timeReserved for application-defined implementations.
Note
This method should not normally need to be called externally! Exceptions might include: a) implementing a new action; b) advanced debugging
See also
nom::RepeatForAction, nom::RepeatForeverAction

Implements nom::IActionObject.

◆ set_speed()

virtual void nom::SequenceAction::set_speed ( real32 speed)
overridevirtual

Set the speed factor of the child actions.

Remarks
This has no effect on the parent (this object).

Reimplemented from nom::IActionObject.

◆ set_timing_curve()

virtual void nom::SequenceAction::set_timing_curve ( const IActionObject::timing_curve_func & mode)
overridevirtual

Set the timing mode of the child actions.

Remarks
This has no effect on the parent (this object).
See also
nom::IActionObject::timing_curve_func

Reimplemented from nom::IActionObject.

◆ ActionTest

friend class ActionTest
friend

Allow access into our private parts for unit testing.

Definition at line 45 of file SequenceAction.hpp.

Member Data Documentation

◆ actions_

container_type nom::SequenceAction::actions_
private

The child actions.

Definition at line 97 of file SequenceAction.hpp.

◆ actions_iterator_

container_iterator nom::SequenceAction::actions_iterator_
private

Definition at line 98 of file SequenceAction.hpp.

◆ DEBUG_CLASS_NAME

const char* nom::SequenceAction::DEBUG_CLASS_NAME
staticprivate

Definition at line 86 of file SequenceAction.hpp.

◆ num_actions_

nom::size_type nom::SequenceAction::num_actions_
private

The total number of actions at the time of construction.

Definition at line 104 of file SequenceAction.hpp.

◆ num_completed_

nom::size_type nom::SequenceAction::num_completed_
private

The total number of completed actions.

Definition at line 101 of file SequenceAction.hpp.


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