Gamedev Framework (gf)  0.9.0
A C++14 framework for 2D games
Public Member Functions | List of all members
gf::RotateToActivity Class Reference

An activity for a change of angle. More...

#include <gf/Activities.h>

Inheritance diagram for gf::RotateToActivity:
Inheritance graph
[legend]

Public Member Functions

 RotateToActivity (float origin, float target, float &angle, Time duration, Easing easing=Ease::linear)
 Constructor. More...
 
void setOrigin (float origin)
 Change the origin of the activity. More...
 
float getOrigin () const noexcept
 Get the origin of the activity. More...
 
void setTarget (float target)
 Change the target of the activity. More...
 
float getTarget () const noexcept
 Get the target of the activity. More...
 
void setDuration (Time duration)
 Change the duration of the activity. More...
 
Time getDuration () const noexcept
 Get the duration of the activity. More...
 
virtual ActivityStatus run (Time time) override
 Run the activity. More...
 
virtual void restart () override
 Restart the activity. More...
 
- Public Member Functions inherited from gf::Activity
virtual ~Activity ()
 Destructor. More...
 

Detailed Description

An activity for a change of angle.

The activity ensures that the change is no more that \( \pi \) radians.

See also
gf::Tween

Constructor & Destructor Documentation

◆ RotateToActivity()

gf::RotateToActivity::RotateToActivity ( float  origin,
float  target,
float &  angle,
Time  duration,
Easing  easing = Ease::linear 
)

Constructor.

Parameters
originThe origin value
targetThe target value
angleA reference on the value
durationThe duration of the tween
easingThe easing for the interpolation

Member Function Documentation

◆ getDuration()

Time gf::RotateToActivity::getDuration ( ) const
inlinenoexcept

Get the duration of the activity.

Returns
The current duration

◆ getOrigin()

float gf::RotateToActivity::getOrigin ( ) const
inlinenoexcept

Get the origin of the activity.

Returns
The current origin

◆ getTarget()

float gf::RotateToActivity::getTarget ( ) const
inlinenoexcept

Get the target of the activity.

Returns
The current target

◆ restart()

virtual void gf::RotateToActivity::restart ( )
overridevirtual

Restart the activity.

Reimplemented from gf::Activity.

◆ run()

virtual ActivityStatus gf::RotateToActivity::run ( Time  time)
overridevirtual

Run the activity.

Parameters
timeThe time since the last run
Returns
The status of the activity (running or finished)

Implements gf::Activity.

◆ setDuration()

void gf::RotateToActivity::setDuration ( Time  duration)
inline

Change the duration of the activity.

Parameters
durationThe new duration

◆ setOrigin()

void gf::RotateToActivity::setOrigin ( float  origin)
inline

Change the origin of the activity.

Parameters
originThe new origin

◆ setTarget()

void gf::RotateToActivity::setTarget ( float  target)
inline

Change the target of the activity.

Parameters
targetThe new target