CUGL 2.1
Cornell University Game Library
|
#include <CUAction.h>
Public Member Functions | |
Action () | |
~Action () | |
float | getDuration () const |
void | setDuration (float time) |
virtual std::shared_ptr< Action > | clone () |
virtual void | load (const std::shared_ptr< SceneNode > &target, Uint64 *state) |
virtual void | update (const std::shared_ptr< SceneNode > &target, Uint64 *state, float dt) |
virtual std::string | toString (bool verbose=false) const |
operator std::string () const | |
Protected Attributes | |
float | _duration |
This class provides an template for an animation action template.
An action contains only the definition of the animation. This can include information about the transform to use or the duration of the animation. However, it does not contain any attribute of the target. Hence, an action can be reapplied to different targets.
By itself, an action does nothing. It only specifies an action that may take place. To use an action, it must be passed to the ActionManager. The manager will create an action instance and animate that instance. While an action may be reused many times, an action instance corresponds to a single animation.
To define a custom action, simply create a subclass and override the uppdate method. This is the method that an action uses to update its target Node.
|
inline |
Creates an uninitialized action.
NEVER USE A CONSTRUCTOR WITH NEW. If you want to allocate an object on the heap, use one of the static constructors instead.
|
inline |
Deletes this action, disposing all resources
|
virtual |
Returns a newly allocated copy of this Action.
Reimplemented in cugl::scene2::RotateTo, cugl::scene2::ScaleTo, cugl::scene2::MoveTo, cugl::scene2::Animate, cugl::scene2::FadeIn, cugl::scene2::RotateBy, cugl::scene2::ScaleBy, cugl::scene2::MoveBy, and cugl::scene2::FadeOut.
|
inline |
Returns the duration (in seconds) of this animation
Changing this value in mid-animation has undefined side-effects.
|
inlinevirtual |
Prepares a target for action
The important state of the target is stored in the given state parameter. The semantics of this state is action-dependent.
target | The node to act on |
state | The relevant node state |
Reimplemented in cugl::scene2::RotateTo, cugl::scene2::ScaleTo, cugl::scene2::MoveTo, cugl::scene2::Animate, cugl::scene2::FadeIn, cugl::scene2::ScaleBy, and cugl::scene2::FadeOut.
|
inline |
Cast from an Action to a string.
|
inline |
Sets the duration (in seconds) of this animation
Changing this value in mid-animation has undefined side-effects.
time | the duration (in seconds) of this animation |
|
virtual |
Returns a string representation of the action for debugging purposes.
If verbose is true, the string will include class information. This allows us to unambiguously identify the class.
verbose | Whether to include class information |
Reimplemented in cugl::scene2::RotateTo, cugl::scene2::ScaleTo, cugl::scene2::MoveTo, cugl::scene2::Animate, cugl::scene2::FadeIn, cugl::scene2::ScaleBy, cugl::scene2::RotateBy, cugl::scene2::MoveBy, and cugl::scene2::FadeOut.
|
inlinevirtual |
Executes an action on the given target node.
The important state of the target is stored in the given state parameter. The semantics of this state is action-dependent.
target | The node to act on |
state | The relevant node state |
dt | The elapsed time to animate. |
Reimplemented in cugl::scene2::RotateTo, cugl::scene2::ScaleTo, cugl::scene2::MoveTo, cugl::scene2::Animate, cugl::scene2::FadeIn, cugl::scene2::ScaleBy, cugl::scene2::RotateBy, cugl::scene2::MoveBy, and cugl::scene2::FadeOut.
|
protected |
The duration (in seconds) of the animation