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

#include <CUTransformAction2.h>

Public Member Functions

 RotateTo ()
 
 ~RotateTo ()
 
void dispose ()
 
bool init ()
 
bool init (float angle)
 
float getAngle () const
 
void setAngle (float angle)
 
ActionFunction attach (const std::shared_ptr< scene2::SceneNode > &node)
 

Static Public Member Functions

static std::shared_ptr< RotateToalloc ()
 
static std::shared_ptr< RotateToalloc (float angle)
 

Detailed Description

This factory creates an action rotating to a specific angle.

The angle is measured in radians, counter-clockwise from the x-axis.

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

◆ RotateTo()

cugl::scene2::RotateTo::RotateTo ( )
inline

Creates an uninitialized rotation action.

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

◆ ~RotateTo()

cugl::scene2::RotateTo::~RotateTo ( )
inline

Deletes this action instance, disposing all resources

Member Function Documentation

◆ alloc() [1/2]

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

Returns a newly allocated rotation animation towards the x-axis

The target angle is set to 0.0. Because of how rotatations are interpolated, this guarantees that the rotation will be clockwise.

Returns
a newly allocated rotation animation towards the x-axis

◆ alloc() [2/2]

static std::shared_ptr< RotateTo > cugl::scene2::RotateTo::alloc ( float  angle)
inlinestatic

Returns a newly allocated rotation animation towards the given angle

This angle is measured in radians, counter-clockwise from the x-axis. The animation will be counter-clockwise if the target angle is larger than the current one. Otherwise it will be clockwise.

Parameters
angleThe target rotation angle
Returns
a newly allocated rotation animation towards the given angle

◆ attach()

ActionFunction cugl::scene2::RotateTo::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::RotateTo::dispose ( )
inline

Disposes all of the resources used by this action.

A disposed action can be safely reinitialized.

◆ getAngle()

float cugl::scene2::RotateTo::getAngle ( ) const
inline

Returns the rotation target angle for this action.

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

Returns
the rotation target angle for this action.

◆ init() [1/2]

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

Initializes a rotation animation towards the x-axis

The target angle is set to 0.0. Because of how rotatations are interpolated, this guarantees that the rotation will be clockwise.

Returns
true if initialization was successful.

◆ init() [2/2]

bool cugl::scene2::RotateTo::init ( float  angle)

Initializes a rotation animation towards the given angle

This angle is measured in radians, counter-clockwise from the x-axis. The animation will be counter-clockwise if the target angle is larger than the current one. Otherwise it will be clockwise.

Parameters
angleThe target rotation angle
Returns
true if initialization was successful.

◆ setAngle()

void cugl::scene2::RotateTo::setAngle ( float  angle)
inline

Sets the rotation target angle for this action.

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

Parameters
angleThe rotation target angle for this action.

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