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

Public Member Functions

 Anim ()
 Default constructor, constructs an empty nameless Anim object.
 
 Anim (std::string name, std::vector< AnimFrame > frames, bool loop=true)
 Constructs an Anim object, describes one animation. More...
 
void add (const AnimFrame &frame)
 Adds an AnimFrame to the Anim. More...
 
auto getName () const -> const std::string &
 Get the name of the Anim. More...
 
auto getFrame (int index) const -> const AnimFrame &
 Get a specific frame in the Anim. More...
 
auto size () const -> int
 Get the number of AnimFrame objects in the Anim. More...
 

Public Attributes

bool loop = true
 Should the Anim loop when it ends ?
 

Detailed Description

Definition at line 35 of file Anim.hpp.

Constructor & Destructor Documentation

◆ Anim()

ns::Anim::Anim ( std::string  name,
std::vector< AnimFrame frames,
bool  loop = true 
)

Constructs an Anim object, describes one animation.

Parameters
nameAnimation name
framesVector of AnimFrame objects
loopShould the Anim loop when it ends ?

Member Function Documentation

◆ add()

void ns::Anim::add ( const AnimFrame frame)

Adds an AnimFrame to the Anim.

Parameters
frameAnimFrame to add

◆ getFrame()

auto ns::Anim::getFrame ( int  index) const -> const AnimFrame &

Get a specific frame in the Anim.

Parameters
indexIndex of the AnimFrame to get
Returns
AnimFrame object at the given index

◆ getName()

auto ns::Anim::getName ( ) const -> const std::string &

Get the name of the Anim.

Returns
Anim name

◆ size()

auto ns::Anim::size ( ) const -> int

Get the number of AnimFrame objects in the Anim.

Returns
Number of AnimFrame in the Anim

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