NasNas
An intuitive and beginner friendly 2D game framework for C++
Public Member Functions | List of all members
ns::AnimPlayer Class Reference

Public Member Functions

 AnimPlayer ()
 Constructs an empty AnimPlayer.
 
void play (const Anim &animation)
 Plays an Anim if it is different from the current Anim.
 
void replay (const Anim &animation)
 Plays an Anim from start even if it is the same as the currently running Anim.
 
void replay ()
 Replays the current Anim.
 
void resume ()
 Resume a paused or stoped animation.
 
void pause ()
 Pause the animation, the current active frame is not changed.
 
void stop ()
 Stop the animation and go back to first frame.
 
auto isPlaying () const -> bool
 Does what you expect it to do. More...
 
auto getAnim () const -> const Anim *
 Get the currentlty played Anim. More...
 
auto getActiveFrame () const -> const AnimFrame &
 Get the active frame of the player. More...
 
void setPlaySpeed (float speed)
 Set the play speed. More...
 
void update ()
 Updates the AnimPlayer.
 
void update (sf::Sprite &spr)
 

Detailed Description

Definition at line 87 of file Anim.hpp.

Member Function Documentation

◆ getActiveFrame()

auto ns::AnimPlayer::getActiveFrame ( ) const -> const AnimFrame &

Get the active frame of the player.

Returns
The currently played frame

◆ getAnim()

auto ns::AnimPlayer::getAnim ( ) const -> const Anim *

Get the currentlty played Anim.

Returns
Pointer to Anim object

◆ isPlaying()

auto ns::AnimPlayer::isPlaying ( ) const -> bool

Does what you expect it to do.

Returns
Returns if the animation is being played or not

◆ setPlaySpeed()

void ns::AnimPlayer::setPlaySpeed ( float  speed)

Set the play speed.

Parameters
speedPlay speed. 0 stops the player; 1 is normal speed

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