nCine::BaseSprite class

Base class for textured sprites.

Common base for drawable sprites such as Sprite and MeshSprite. Holds the texture, the source rectangle to blit from it, horizontal/vertical flipping and the palette offset used by the palette shaders. This class is abstract; instances are created through its derived classes.

Base classes

class DrawableNode
Base class for scene nodes that can be drawn through the render queue.

Derived classes

class Jazz2::Actors::ActorBase::ActorRenderer
Actor renderer.
class MeshSprite
A scene node representing a mesh with vertices and UVs.
class Sprite
Scene node that draws a single textured quad.

Constructors, destructors, conversion operators

BaseSprite(BaseSprite&&) defaulted
BaseSprite(SceneNode* parent, Texture* texture, float xx, float yy) protected
Protected constructor accessible only by derived sprite classes.
BaseSprite(SceneNode* parent, Texture* texture, Vector2f position) protected
Protected constructor accessible only by derived sprite classes.
BaseSprite(const BaseSprite& other) protected
Protected copy constructor used to clone objects.

Public functions

auto operator=(BaseSprite&&) -> BaseSprite& defaulted
auto operator=(const BaseSprite&) -> BaseSprite& deleted
void SetSize(float width, float height)
Sets the sprite size.
void SetSize(Vector2f size)
Sets the sprite size from a Vector2f.
auto GetTexture() const -> const Texture*
Returns the texture object.
void SetTexture(Texture* texture)
Sets the texture object.
void ResetTexture()
Triggers a texture update without setting a new texture.
auto GetTexRect() const -> Recti
Returns the texture source rectangle used for blitting.
void SetTexRect(const Recti& rect)
Sets the texture source rectangle used for blitting.
auto IsFlippedX() const -> bool
Returns whether the sprite texture is horizontally flipped.
void SetFlippedX(bool flippedX)
Flips the texture rectangle horizontally.
auto IsFlippedY() const -> bool
Returns whether the sprite texture is vertically flipped.
void SetFlippedY(bool flippedY)
Flips the texture rectangle vertically.
auto GetPaletteOffset() const -> float
Returns the flat palette offset added to the per-pixel index by palette shaders.
void SetPaletteOffset(float paletteOffset)
Sets the flat palette offset used by palette shaders (no effect on non-palette shaders).

Protected functions

void ShaderHasChanged() override
Performs the required tasks upon a change to the shader.
void TextureHasChanged(Texture* newTexture) pure virtual
Performs the required tasks upon a change to the texture.
void UpdateRenderCommand() override
Updates the render command before the node is drawn.