24#ifndef GF_BASIC_SPRITE_H
25#define GF_BASIC_SPRITE_H
27#include "GraphicsApi.h"
32#ifndef DOXYGEN_SHOULD_SKIP_THIS
92 [[deprecated(
"You should use setTexture(const Texture&, const RectF&) instead")]]
135 return m_texture !=
nullptr;
172 return m_textureRect;
197#ifndef DOXYGEN_SHOULD_SKIP_THIS
A basic sprite.
Definition: BasicSprite.h:46
RectF getLocalBounds() const
Get the local bounding rectangle of the entity.
void updateGeometry(Span< Vertex > vertices)
void setTexture(const Texture &texture, const RectF &textureRect=RectF::fromSize({ 1.0f, 1.0f }))
Change the source texture of the sprite.
void setTextureRect(const RectF &rect)
Set the sub-rectangle of the texture that the sprite will display.
const RectF & getTextureRect() const
Get the sub-rectangle of the texture displayed by the sprite.
Definition: BasicSprite.h:171
void unsetTexture()
Unset the source texture of the sprite.
const Texture & getTexture() const
Get the source texture of the sprite.
Definition: BasicSprite.h:123
void setTexture(const Texture &texture, bool resetRect)
Change the source texture of the sprite.
BasicSprite()
Default constructor.
BasicSprite(const Texture &texture)
Construct the sprite from a source texture.
bool hasTexture() const
Check if a texture is set.
Definition: BasicSprite.h:134
BasicSprite(const Texture &texture, const RectF &textureRect)
Construct the sprite from a sub-rectangle of a source texture.
A span.
Definition: Span.h:414
A texture for colored images.
Definition: Texture.h:313
The namespace for gf classes.
static constexpr Rect< float > fromSize(Vector< float, 2 > size) noexcept
Create a rectangle from a size.
Definition: Rect.h:114