nCine::AnimatedSprite class

Animated sprite.

Base classes

class Sprite
Scene node representing a regular sprite.

Public static functions

static auto sType() -> ObjectType

Constructors, destructors, conversion operators

AnimatedSprite()
Default constructor for an animated sprite with no parent and no texture, positioned in the origin.
AnimatedSprite(SceneNode* parent, Texture* texture)
Constructor for an animated sprite with a parent and texture, positioned in the relative origin.
AnimatedSprite(Texture* texture) explicit
Constructor for an animated sprite with a texture but no parent, positioned in the origin.
AnimatedSprite(SceneNode* parent, Texture* texture, float xx, float yy)
Constructor for an animated sprite with a parent, a texture and a specified relative position.
AnimatedSprite(SceneNode* parent, Texture* texture, Vector2f position)
Constructor for an animated sprite with a parent, a texture and a specified relative position as a vector.
AnimatedSprite(Texture* texture, float xx, float yy)
Constructor for an animated sprite with a texture and a specified position but no parent.
AnimatedSprite(Texture* texture, Vector2f position)
Constructor for an animated sprite with a texture and a specified position as a vector but no parent.
AnimatedSprite(AnimatedSprite&&) defaulted
AnimatedSprite(const AnimatedSprite& other) protected
Protected copy constructor used to clone objects.

Public functions

auto operator=(const AnimatedSprite&) -> AnimatedSprite& deleted
auto operator=(AnimatedSprite&&) -> AnimatedSprite& defaulted
auto clone() const -> AnimatedSprite
Returns a copy of this object.
auto isPaused() const -> bool
Returns true if the current animation is paused.
void setPaused(bool isPaused)
Sets the pause state for the animation.
void OnUpdate(float timeMult) override
Called every frame to update the object state.
void addAnimation(const RectAnimation& anim)
Adds a new animation.
void addAnimation(RectAnimation&& anim)
Adds a new animation with move semantics.
void clearAnimations()
Deletes all animations.
auto numAnimations() -> std::uint32_t
Returns the number of animations.
auto animations() -> SmallVectorImpl<RectAnimation>&
Returns the array of all animations.
auto animations() const -> const SmallVectorImpl<RectAnimation>&
Returns the constant array of all animations.
auto animationIndex() const -> std::uint32_t
Returns the index of the current animation.
void setAnimationIndex(std::uint32_t animIndex)
Sets current animation index and its frame number.
auto currentAnimation() -> RectAnimation*
Returns the current animation, if any.
auto currentAnimation() const -> const RectAnimation*
Returns the constant version of current animation, if any.
auto frame() const -> std::uint32_t
Returns the frame number of current animation.
void setFrame(std::uint32_t frameNum)
Sets current animation to a specified frame number.