nCine::Sprite class

Scene node that draws a single textured quad.

A drawable node that renders a rectangular sprite from a texture (or an untextured solid quad). Its size defaults to the texture dimensions and the whole texture is used as the source rectangle.

Base classes

class BaseSprite
Base class for textured sprites.

Derived classes

class AnimatedSprite
Textured sprite that cycles through one or more frame animations.
class Particle
Renders a single particle.

Public static functions

static auto sType() -> ObjectType

Constructors, destructors, conversion operators

Sprite()
Constructs a sprite with no parent and no texture, positioned at the origin.
Sprite(SceneNode* parent, Texture* texture)
Constructs a sprite with a parent and a texture, positioned at the relative origin.
Sprite(Texture* texture) explicit
Constructs a sprite with a texture but no parent, positioned at the origin.
Sprite(SceneNode* parent, Texture* texture, float xx, float yy)
Constructs a sprite with a parent, a texture and a relative position given as two coordinates.
Sprite(SceneNode* parent, Texture* texture, Vector2f position)
Constructs a sprite with a parent, a texture and a relative position given as a vector.
Sprite(Texture* texture, float xx, float yy)
Constructs a sprite with a texture and a position given as two coordinates but no parent.
Sprite(Texture* texture, Vector2f position)
Constructs a sprite with a texture and a position given as a vector but no parent.
Sprite(Sprite&&) defaulted
Sprite(const Sprite& other) protected
Protected copy constructor used to clone objects.

Public functions

auto operator=(const Sprite&) -> Sprite& deleted
auto operator=(Sprite&&) -> Sprite& defaulted
auto clone() const -> Sprite
Returns a copy of this object.

Protected functions

void textureHasChanged(Texture* newTexture) override
Performs the required tasks upon a change to the texture.