|
R-Type
Distributed multiplayer game engine in C++
|
Component representing a visual sprite from a texture. More...
#include <Sprite.hpp>
Public Member Functions | |
| 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. | |
| ~Sprite () override=default | |
| std::string | getTextureKey () const |
| Get the texture key. | |
| Rectangle | getSourceRect () const |
| Get the source rectangle. | |
| float | getScale () const |
| Get the scale factor. | |
| float | getRotation () const |
| Get the rotation angle. | |
| bool | isFlippedX () const |
| Check if horizontally flipped. | |
| bool | isFlippedY () const |
| Check if vertically flipped. | |
| int | getLayer () const |
| Get the rendering layer. | |
| void | setTextureKey (const std::string &textureKey) |
| Set the texture key. | |
| void | setSourceRect (Rectangle sourceRect) |
| Set the source rectangle. | |
| void | setScale (float scale) |
| Set the scale factor. | |
| void | setRotation (float rotation) |
| Set the rotation angle. | |
| void | setFlipX (bool flipX) |
| Set horizontal flip state. | |
| void | setFlipY (bool flipY) |
| Set vertical flip state. | |
| void | setLayer (int layer) |
| Set the rendering layer. | |
| ComponentType | getType () const override |
| Get the component type ID. | |
Public Member Functions inherited from ecs::IComponent | |
| virtual | ~IComponent ()=default |
| Virtual destructor. | |
Private Attributes | |
| std::string | _textureKey |
| Texture identifier (e.g., "r-typesheet1") | |
| Rectangle | _sourceRect |
| Source rectangle in the texture. | |
| float | _scale |
| Scale factor (1.0 = original size) | |
| float | _rotation |
| Rotation angle in degrees. | |
| bool | _flipX |
| Horizontal flip flag. | |
| bool | _flipY |
| Vertical flip flag. | |
| int | _layer |
| Rendering layer for Z-ordering. | |
Component representing a visual sprite from a texture.
Stores visual rendering data including texture identifier, source rectangle, scale, rotation, flip states, and rendering layer for Z-ordering.
Definition at line 32 of file Sprite.hpp.
|
inline |
Constructor with all sprite parameters.
| textureKey | Texture identifier (e.g., "r-typesheet1") |
| sourceRect | Source rectangle in the texture |
| scale | Scale factor (1.0 = original size) |
| rotation | Rotation angle in degrees |
| flipX | Horizontal flip flag |
| flipY | Vertical flip flag |
| layer | Rendering layer for Z-ordering |
Definition at line 44 of file Sprite.hpp.
|
overridedefault |
|
inline |
Get the rendering layer.
Definition at line 96 of file Sprite.hpp.
References _layer.
|
inline |
Get the rotation angle.
Definition at line 78 of file Sprite.hpp.
References _rotation.
|
inline |
Get the scale factor.
Definition at line 72 of file Sprite.hpp.
References _scale.
|
inline |
Get the source rectangle.
Definition at line 66 of file Sprite.hpp.
References _sourceRect.
Referenced by Server::_serializeEntity().
|
inline |
Get the texture key.
Definition at line 60 of file Sprite.hpp.
References _textureKey.
|
inlineoverridevirtual |
Get the component type ID.
Implements ecs::IComponent.
Definition at line 144 of file Sprite.hpp.
|
inline |
Check if horizontally flipped.
Definition at line 84 of file Sprite.hpp.
References _flipX.
|
inline |
Check if vertically flipped.
Definition at line 90 of file Sprite.hpp.
References _flipY.
|
inline |
Set horizontal flip state.
| flipX | True to flip horizontally |
Definition at line 126 of file Sprite.hpp.
References _flipX.
|
inline |
Set vertical flip state.
| flipY | True to flip vertically |
Definition at line 132 of file Sprite.hpp.
References _flipY.
|
inline |
Set the rendering layer.
| layer | New layer value for Z-ordering |
Definition at line 138 of file Sprite.hpp.
References _layer.
|
inline |
Set the rotation angle.
| rotation | New rotation in degrees |
Definition at line 120 of file Sprite.hpp.
References _rotation.
|
inline |
Set the scale factor.
| scale | New scale value |
Definition at line 114 of file Sprite.hpp.
References _scale.
|
inline |
Set the source rectangle.
| sourceRect | New source rectangle |
Definition at line 108 of file Sprite.hpp.
References _sourceRect.
Referenced by ecs::AnimationSystem::update().
|
inline |
Set the texture key.
| textureKey | New texture identifier |
Definition at line 102 of file Sprite.hpp.
References _textureKey.
|
private |
Horizontal flip flag.
Definition at line 151 of file Sprite.hpp.
Referenced by isFlippedX(), and setFlipX().
|
private |
Vertical flip flag.
Definition at line 152 of file Sprite.hpp.
Referenced by isFlippedY(), and setFlipY().
|
private |
Rendering layer for Z-ordering.
Definition at line 153 of file Sprite.hpp.
Referenced by getLayer(), and setLayer().
|
private |
Rotation angle in degrees.
Definition at line 150 of file Sprite.hpp.
Referenced by getRotation(), and setRotation().
|
private |
Scale factor (1.0 = original size)
Definition at line 149 of file Sprite.hpp.
Referenced by getScale(), and setScale().
|
private |
Source rectangle in the texture.
Definition at line 148 of file Sprite.hpp.
Referenced by getSourceRect(), and setSourceRect().
|
private |
Texture identifier (e.g., "r-typesheet1")
Definition at line 147 of file Sprite.hpp.
Referenced by getTextureKey(), and setTextureKey().