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

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

#include <gf/Activities.h>

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

Public Member Functions

 MoveToActivity (Vector2f origin, Vector2f target, Vector2f &position, Time duration, Easing easing=Ease::linear)
 Constructor. More...
 
void setOrigin (Vector2f origin)
 Change the origin of the activity. More...
 
Vector2f getOrigin () const noexcept
 Get the origin of the activity. More...
 
void setTarget (Vector2f target)
 Change the target of the activity. More...
 
Vector2f 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 position.

See also
gf::Tween

Constructor & Destructor Documentation

◆ MoveToActivity()

gf::MoveToActivity::MoveToActivity ( Vector2f  origin,
Vector2f  target,
Vector2f position,
Time  duration,
Easing  easing = Ease::linear 
)

Constructor.

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

Member Function Documentation

◆ getDuration()

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

Get the duration of the activity.

Returns
The current duration

◆ getOrigin()

Vector2f gf::MoveToActivity::getOrigin ( ) const
inlinenoexcept

Get the origin of the activity.

Returns
The current origin

◆ getTarget()

Vector2f gf::MoveToActivity::getTarget ( ) const
inlinenoexcept

Get the target of the activity.

Returns
The current target

◆ restart()

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

Restart the activity.

Reimplemented from gf::Activity.

◆ run()

virtual ActivityStatus gf::MoveToActivity::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::MoveToActivity::setDuration ( Time  duration)
inline

Change the duration of the activity.

Parameters
durationThe new duration

◆ setOrigin()

void gf::MoveToActivity::setOrigin ( Vector2f  origin)
inline

Change the origin of the activity.

Parameters
originThe new origin

◆ setTarget()

void gf::MoveToActivity::setTarget ( Vector2f  target)
inline

Change the target of the activity.

Parameters
targetThe new target