|
Flint Engine
Modular C++20 2D game engine powered by SDL3
|
A 2-D textured quad that references a GPUTexture. More...
#include <flint/graphics/sprite.h>
Inheritance diagram for Flint::Sprite:
Collaboration diagram for Flint::Sprite:Public Member Functions | |
| Sprite (GPUTexture *texture) | |
Construct a Sprite backed by texture. | |
| void | emit (RenderQueue &queue) const override |
| Emit this drawable's rendering work for the current frame. | |
| void | setTextureRect (const IntRect &rect) |
| Set the source rectangle (sub-region) within the texture. | |
| void | setPosition (const Vec2f &pos) |
| Set the world-space position of the sprite's local origin. | |
| void | setScale (const Vec2f &scale) |
| Set per-axis scale factors. | |
| void | setOrigin (const Vec2f &origin) |
| Set the local pivot point used for rotation and positioning. | |
| void | setRotation (float rotation) |
| Set the rotation angle. | |
| void | setColor (const Color &color) |
| Set the RGBA tint color multiplied against the texture. | |
| void | move (const Vec2f &offset) |
Translate the sprite by offset. | |
| const FloatRect & | getSrcRect () const |
| Get the current source rectangle in texture space. | |
| const FloatRect & | getDstRect () const |
| Get the current destination rectangle in world space. | |
| const Vec2f & | getPosition () const |
| Get the current world-space position. | |
| const Vec2f & | getScale () const |
| Get the current scale factors. | |
| float | getRotation () const |
| Get the current rotation angle in radians. | |
| const Vec2f & | getOrigin () const |
| Get the current local pivot point. | |
| const Color & | getColor () const |
| Get the current tint color. | |
Public Member Functions inherited from Flint::Drawable | |
| void | setGPUTexture (GPUTexture *texture) |
| Associate a texture with this drawable. | |
| GPUTexture * | getGPUTexture () const |
| Get the associated GPU texture. | |
Additional Inherited Members | |
Protected Attributes inherited from Flint::Drawable | |
| GPUTexture * | m_gpuTexture = nullptr |
| Non-owning reference to the GPU texture asset. | |
A 2-D textured quad that references a GPUTexture.
Supports position, scale, rotation, a local origin pivot, an RGBA tint, and a source rectangle for sprite-sheet animation.