BaseSprite class
#include <nCine/Graphics/BaseSprite.h>
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 texture() 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 texRect() 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 paletteOffset() 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.