Sprite component optimised to work with the ECS. Sprite components require their entity to also have a Drawable component and a Transform component.
More...
#include <Sprite.hpp>
|
| Sprite () |
| Default constructor.
|
|
| Sprite (const sf::Texture &) |
| Construct a sprite with a texture.
|
|
void | setTexture (const sf::Texture &, bool resize=true) |
| Sets the texture with which to draw this sprite. By default sprites are resized to the size of this texture.
|
|
void | setTextureRect (sf::FloatRect) |
| Sets a sub rectangle of the current texture to be used when drawing. When a new texture is set on the sprite this is reset to the size of the texture,.
|
|
void | setColour (sf::Color) |
| Sets the colour to be multiplied with this sprite when drawing.
|
|
const sf::Texture * | getTexture () const |
| Returns a pointer to the sprite's active texture.
|
|
sf::FloatRect | getTextureRect () const |
| Returns the current sub-rectangle used to crop the sprite.
|
|
sf::Color | getColour () const |
| Returns the current sprite colour.
|
|
sf::FloatRect | getTextureBounds () const |
| Returns the bounds created by the current texture rect.
|
|
sf::Vector2f | getSize () const |
| Returns the size of the sprite based on the current texture rect.
|
|
std::vector< Animation > & | getAnimations () |
|
const std::vector< Animation > & | getAnimations () const |
|
std::size_t | getAnimationCount () const |
|
|
static constexpr std::size_t | MaxFrames = 64 |
| Maximum number of frames in an animation.
|
|
static constexpr std::size_t | MaxAnimations = 32 |
| Maximum number of animations per sprite.
|
|
|
class | SpriteSystem |
|
class | SpriteSheet |
|
class | SpriteAnimator |
|
Sprite component optimised to work with the ECS. Sprite components require their entity to also have a Drawable component and a Transform component.
◆ getAnimations() [1/2]
std::vector<Animation>& xy::Sprite::getAnimations |
( |
| ) |
|
|
inline |
/brief Returns a reference to the sprites animation array.
◆ getAnimations() [2/2]
const std::vector<Animation>& xy::Sprite::getAnimations |
( |
| ) |
const |
|
inline |
/brief Returns a const reference to the sprites animation array.