CUGL 3.0
Cornell University Game Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
cugl::scene2::MoveTo Class Reference

#include <CUTransformAction2.h>

Public Member Functions

 MoveTo ()
 
 ~MoveTo ()
 
void dispose ()
 
bool init ()
 
bool init (const Vec2 target)
 
const Vec2getTarget () const
 
void setTarget (const Vec2 &target)
 
ActionFunction attach (const std::shared_ptr< scene2::SceneNode > &node)
 

Static Public Member Functions

static std::shared_ptr< MoveToalloc ()
 
static std::shared_ptr< MoveToalloc (const Vec2 target)
 

Detailed Description

This factory creates an action for movement to a given position

This class is actually a factory for creating movement actions. To create an action, call attach with the appropriate SceneNode. Note that this class contains no duration information. That is supplied when the action is added to ActionTimeline.

Constructor & Destructor Documentation

◆ MoveTo()

cugl::scene2::MoveTo::MoveTo ( )
inline

Creates an uninitialized movement animation.

NEVER USE A CONSTRUCTOR WITH NEW. If you want to allocate an object on the heap, use one of the static constructors instead.

◆ ~MoveTo()

cugl::scene2::MoveTo::~MoveTo ( )
inline

Deletes this animation, disposing all resources

Member Function Documentation

◆ alloc() [1/2]

static std::shared_ptr< MoveTo > cugl::scene2::MoveTo::alloc ( )
inlinestatic

Returns a newly allocated motion animation towards the origin.

The target position is set to (0.0, 0.0), meaning that this action will move a node towards the origin.

Returns
a newly allocated motion animation towards the origin.

◆ alloc() [2/2]

static std::shared_ptr< MoveTo > cugl::scene2::MoveTo::alloc ( const Vec2  target)
inlinestatic

Returns a newly allocated motion animation towards the given position.

Parameters
targetThe target position
Returns
a newly allocated motion animation towards the given position.

◆ attach()

ActionFunction cugl::scene2::MoveTo::attach ( const std::shared_ptr< scene2::SceneNode > &  node)

Returns an action attaching this animation to the given scene node

This action will reference this object during the animation. Any changes to this object during that time may alter the animation.

Note that the action has no associated duration. That should be set when it is added to ActionTimeline.

Parameters
nodeThe node to attach
Returns
an action attaching this animation to the given scene node

◆ dispose()

void cugl::scene2::MoveTo::dispose ( )
inline

Disposes all of the resources used by this animation.

A disposed animation can be safely reinitialized.

◆ getTarget()

const Vec2 & cugl::scene2::MoveTo::getTarget ( ) const
inline

Returns the movement target for this action.

Changing this value for an actively animating action can have undefined side effects.

Returns
the movement target for this action.

◆ init() [1/2]

bool cugl::scene2::MoveTo::init ( )
inline

Initializes a movement animation towards the origin.

The target position is set to (0.0, 0.0), meaning that this action will move a node towards the origin.

Returns
true if initialization was successful.

◆ init() [2/2]

bool cugl::scene2::MoveTo::init ( const Vec2  target)

Initializes a movement animation towards towards the given position.

Parameters
targetThe target position
Returns
true if initialization was successful.

◆ setTarget()

void cugl::scene2::MoveTo::setTarget ( const Vec2 target)
inline

Sets the movement target for this action.

Changing this value for an actively animating action can have undefined side effects.

Parameters
targetthe movement target for this action.

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