stmm-games-doc  0.32.0
Classes | Public Member Functions | List of all members
stmg::DynAnimation Class Reference

Classes

struct  DynImage
 

Public Member Functions

 DynAnimation () noexcept
 Constructor. More...
 
void addImage (int32_t nNaturalDuration, shared_ptr< Image > &refImage, double fRelX, double fRelY, double fRelW, double fRelH, int32_t nPriority) noexcept
 Add an image. More...
 
void addImage (int32_t nNaturalDuration, shared_ptr< Image > &refImage, FRect oRelRect, int32_t nPriority) noexcept
 Add an image. More...
 
void addImage (int32_t nNaturalDuration, DynImage &&oDynImage) noexcept
 Add an image. More...
 
const DynImagegetImage (double fElapsed) noexcept
 Get the image data at a certain unary time of the animation. More...
 
int32_t getImageIdx (double fElapsed) noexcept
 The image index at a certain unary time of the animation. More...
 
int32_t getNaturalDuration () const noexcept
 The natural duration of the whole animation in milliseconds. More...
 
int32_t getTotImages () const noexcept
 The number of images. More...
 
const DynImagegetImageByIdx (int32_t nIdx) noexcept
 Get image data by index. More...
 

Constructor & Destructor Documentation

◆ DynAnimation()

stmg::DynAnimation::DynAnimation ( )
noexcept

Constructor.

Member Function Documentation

◆ addImage() [1/3]

void stmg::DynAnimation::addImage ( int32_t  nNaturalDuration,
shared_ptr< Image > &  refImage,
double  fRelX,
double  fRelY,
double  fRelW,
double  fRelH,
int32_t  nPriority 
)
noexcept

◆ addImage() [2/3]

void stmg::DynAnimation::addImage ( int32_t  nNaturalDuration,
shared_ptr< Image > &  refImage,
FRect  oRelRect,
int32_t  nPriority 
)
noexcept

◆ addImage() [3/3]

void stmg::DynAnimation::addImage ( int32_t  nNaturalDuration,
DynImage &&  oDynImage 
)
noexcept

Add an image.

The natural duration can also e interpreted as weight if the duration of the animation is determined by the model.

When an animation can't paint all the images because the frame rate is too low, it chooses the one with the highest priority.

Parameters
nNaturalDurationThe duration in milliseconds in the animation. Must be positive.
oDynImageThe image data.

◆ getImage()

const DynImage& stmg::DynAnimation::getImage ( double  fElapsed)
noexcept

Get the image data at a certain unary time of the animation.

Elapsed value 0.0 is start, 1.0 is end of animation.

Parameters
fElapsedThe unary time. Must be >= 0.0 and <= 1.0.
Returns
The image data.

◆ getImageByIdx()

const DynImage& stmg::DynAnimation::getImageByIdx ( int32_t  nIdx)
noexcept

Get image data by index.

Parameters
nIdxThe index. Must be >= 0 and < getTotImages().
Returns
The image data.

◆ getImageIdx()

int32_t stmg::DynAnimation::getImageIdx ( double  fElapsed)
noexcept

The image index at a certain unary time of the animation.

Elapsed value 0.0 is start, 1.0 is end of animation.

Parameters
fElapsedThe unary time. Must be >= 0.0 and <= 1.0.
Returns
The index starting from 0 (the first added image).

◆ getNaturalDuration()

int32_t stmg::DynAnimation::getNaturalDuration ( ) const
noexcept

The natural duration of the whole animation in milliseconds.

Returns
The sum of all natural durations of the added images.

◆ getTotImages()

int32_t stmg::DynAnimation::getTotImages ( ) const
noexcept

The number of images.

Returns
The total number of images.