A 2-D textured quad that references a GPUTexture.
More...
#include <flint/graphics/sprite.h>
|
| FLINT_API | Sprite (GPUTexture *texture) |
| | Construct a Sprite backed by texture.
|
| |
| FLINT_API void | emit (RenderQueue &queue) const override |
| | Emit this drawable's rendering work for the current frame.
|
| |
| FLINT_API void | setTextureRect (const IntRect &rect) |
| | Set the source rectangle (sub-region) within the texture.
|
| |
| FLINT_API void | setPosition (const Vec2f &pos) |
| | Set the world-space position of the sprite's local origin.
|
| |
| FLINT_API void | setScale (const Vec2f &scale) |
| | Set per-axis scale factors.
|
| |
| FLINT_API void | setOrigin (const Vec2f &origin) |
| | Set the local pivot point used for rotation and positioning.
|
| |
| FLINT_API void | setRotation (float rotation) |
| | Set the rotation angle.
|
| |
| FLINT_API void | setColor (const Color &color) |
| | Set the RGBA tint color multiplied against the texture.
|
| |
| FLINT_API void | move (const Vec2f &offset) |
| | Translate the sprite by offset.
|
| |
|
FLINT_API const FloatRect & | getSrcRect () const |
| | Get the current source rectangle in texture space.
|
| |
|
FLINT_API const FloatRect & | getDstRect () const |
| | Get the current destination rectangle in world space.
|
| |
|
FLINT_API const Vec2f & | getPosition () const |
| | Get the current world-space position.
|
| |
|
FLINT_API const Vec2f & | getScale () const |
| | Get the current scale factors.
|
| |
|
FLINT_API float | getRotation () const |
| | Get the current rotation angle in radians.
|
| |
|
FLINT_API const Vec2f & | getOrigin () const |
| | Get the current local pivot point.
|
| |
|
FLINT_API const Color & | getColor () const |
| | Get the current tint color.
|
| |
| void | setGPUTexture (GPUTexture *texture) |
| | Associate a texture with this drawable.
|
| |
| GPUTexture * | getGPUTexture () const |
| | Get the associated GPU texture.
|
| |
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.
Definition at line 19 of file sprite.h.
◆ Sprite()
| FLINT_API Flint::Sprite::Sprite |
( |
GPUTexture * | texture | ) |
|
|
explicit |
Construct a Sprite backed by texture.
- Parameters
-
| texture | Non-owning pointer to the GPU texture. Must remain valid for the lifetime of this Sprite. |
◆ emit()
| FLINT_API void Flint::Sprite::emit |
( |
RenderQueue & | queue | ) |
const |
|
overridevirtual |
Emit this drawable's rendering work for the current frame.
Called once after submitted drawables have been sorted by DrawLayer. Implementations must enqueue work through queue rather than issuing immediate GPU commands.
- Parameters
-
| queue | Queue receiving this drawable's rendering work. |
Implements Flint::Drawable.
◆ move()
| FLINT_API void Flint::Sprite::move |
( |
const Vec2f & | offset | ) |
|
Translate the sprite by offset.
- Parameters
-
| offset | World-space delta to add to the current position. |
◆ setColor()
| FLINT_API void Flint::Sprite::setColor |
( |
const Color & | color | ) |
|
Set the RGBA tint color multiplied against the texture.
- Parameters
-
| color | Tint color (white = no tint). |
◆ setOrigin()
| FLINT_API void Flint::Sprite::setOrigin |
( |
const Vec2f & | origin | ) |
|
Set the local pivot point used for rotation and positioning.
- Parameters
-
| origin | Pivot in local (object) space. |
◆ setPosition()
| FLINT_API void Flint::Sprite::setPosition |
( |
const Vec2f & | pos | ) |
|
Set the world-space position of the sprite's local origin.
- Parameters
-
| pos | World-space position of the sprite origin. |
◆ setRotation()
| FLINT_API void Flint::Sprite::setRotation |
( |
float | rotation | ) |
|
Set the rotation angle.
- Parameters
-
| rotation | Angle in radians. |
◆ setScale()
| FLINT_API void Flint::Sprite::setScale |
( |
const Vec2f & | scale | ) |
|
Set per-axis scale factors.
- Parameters
-
| scale | Scale (1, 1) = original texture size. |
◆ setTextureRect()
| FLINT_API void Flint::Sprite::setTextureRect |
( |
const IntRect & | rect | ) |
|
Set the source rectangle (sub-region) within the texture.
- Parameters
-
| rect | Integer pixel rectangle in texture space. |
The documentation for this class was generated from the following file: