44 Sprite(
const std::string &textureKey,
Rectangle sourceRect,
float scale = 1.0f,
float rotation = 0.0f,
45 bool flipX =
false,
bool flipY =
false,
int layer = 0)
Base interface for all ECS components.
Component representing a visual sprite from a texture.
std::string _textureKey
Texture identifier (e.g., "r-typesheet1")
float _rotation
Rotation angle in degrees.
void setLayer(int layer)
Set the rendering layer.
void setFlipX(bool flipX)
Set horizontal flip state.
void setFlipY(bool flipY)
Set vertical flip state.
float getScale() const
Get the scale factor.
void setTextureKey(const std::string &textureKey)
Set the texture key.
float getRotation() const
Get the rotation angle.
int getLayer() const
Get the rendering layer.
int _layer
Rendering layer for Z-ordering.
Rectangle _sourceRect
Source rectangle in the texture.
ComponentType getType() const override
Get the component type ID.
void setRotation(float rotation)
Set the rotation angle.
void setSourceRect(Rectangle sourceRect)
Set the source rectangle.
bool _flipY
Vertical flip flag.
~Sprite() override=default
void setScale(float scale)
Set the scale factor.
bool _flipX
Horizontal flip flag.
float _scale
Scale factor (1.0 = original size)
bool isFlippedY() const
Check if vertically flipped.
std::string getTextureKey() const
Get the texture key.
bool isFlippedX() const
Check if horizontally flipped.
Rectangle getSourceRect() const
Get the source rectangle.
Sprite(const std::string &textureKey, Rectangle sourceRect, float scale=1.0f, float rotation=0.0f, bool flipX=false, bool flipY=false, int layer=0)
Constructor with all sprite parameters.
Maximum number of distinct component types supported by the Registry.
std::size_t ComponentType
Type alias for component identification.
Rectangle structure defining a region in a texture.
int x
X coordinate of the top-left corner.
int height
Height of the rectangle.
int y
Y coordinate of the top-left corner.
int width
Width of the rectangle.