![]() |
nCine
2025.04.r498-9d36345
A cross-platform 2D game engine
|
The class containing data for a rectangles based animation. More...
#include <RectAnimation.h>
Public Types | |
enum class | LoopMode { DISABLED , ENABLED } |
Loop modes. | |
enum class | RewindMode { FROM_START , BACKWARD } |
Rewind modes. More... | |
Public Member Functions | |
RectAnimation () | |
Default constructor. | |
RectAnimation (float defaultFrameDuration, LoopMode loopMode, RewindMode rewindMode) | |
Constructor for an animation with a specified default frame duration, loop and rewind mode. | |
bool | isPaused () const |
Returns true if the animation is paused. | |
void | setPaused (bool isPaused) |
Sets the pause flag. | |
void | updateFrame (float frameTime) |
Updates current frame based on time passed. | |
unsigned int | numFrames () const |
Returns the number of frames (rectangles) | |
unsigned int | frame () const |
Returns current frame. | |
void | setFrame (unsigned int frameNum) |
Sets current frame. | |
float | defaultFrameDuration () const |
Returns the default frame duration in seconds. | |
void | setDefaultFrameDuration (float defaultFrameDuration) |
Sets the default frame duration in seconds. | |
LoopMode | loopMode () const |
Returns the loop mode. | |
void | setLoopMode (LoopMode loopMode) |
Sets the loop mode. | |
RewindMode | rewindMode () const |
Returns the rewind mode. | |
void | setRewindMode (RewindMode rewindMode) |
Sets the rewind mode. | |
void | addRect (const Recti &rect, float frameDuration) |
Adds a rectangle to the array specifying the frame duration. | |
void | addRect (int x, int y, int w, int h, float frameDuration) |
Creates a rectangle from origin and size and then adds it to the array, specifying the frame duration. | |
void | addRect (const Recti &rect) |
Adds a rectangle to the array with the default frame duration. | |
void | addRect (int x, int y, int w, int h) |
Creates a rectangle from origin and size and then adds it to the array, with the default frame duration. | |
unsigned int | addRects (const Vector2i &size, const Recti &srcRect, unsigned int rectsToSkip, const Vector2i &padding, float frameDuration) |
Adds rectangles to the array specifying their size, the source rectangle, a number of rectangles to skip, a padding, and the frame duration. More... | |
unsigned int | addRects (const Vector2i &size, const Recti &srcRect, unsigned int rectsToSkip) |
Adds rectangles to the array specifying their size, the source rectangle, and a number of rectangles to skip. More... | |
unsigned int | addRects (const Vector2i &size, const Recti &srcRect) |
Adds rectangles to the array specifying their size and the source rectangle. More... | |
const Recti & | rect () const |
Returns the current rectangle. | |
float | frameDuration () const |
Returns the current frame duration in seconds. | |
nctl::Array< Recti > & | rectangles () |
Returns the array of all rectangles. | |
const nctl::Array< Recti > & | rectangles () const |
Returns the constant array of all rectangles. | |
nctl::Array< float > & | frameDurations () |
Returns the array of all frame durations. | |
const nctl::Array< float > & | frameDurations () const |
Returns the constant array of all frame durations. | |
The class containing data for a rectangles based animation.
|
strong |
Adds rectangles to the array specifying their size and the source rectangle.
|
inline |
Adds rectangles to the array specifying their size, the source rectangle, and a number of rectangles to skip.
unsigned int ncine::RectAnimation::addRects | ( | const Vector2i & | size, |
const Recti & | srcRect, | ||
unsigned int | rectsToSkip, | ||
const Vector2i & | padding, | ||
float | frameDuration | ||
) |
Adds rectangles to the array specifying their size, the source rectangle, a number of rectangles to skip, a padding, and the frame duration.