25#ifndef TGUI_SPRITE_HPP
26#define TGUI_SPRITE_HPP
28#include <TGUI/Color.hpp>
29#include <TGUI/Rect.hpp>
30#include <TGUI/RenderStates.hpp>
31#include <TGUI/Texture.hpp>
32#include <TGUI/Vector2.hpp>
215 [[nodiscard]] const std::shared_ptr<
BackendTexture>& getSvgTexture()
const
224 [[nodiscard]]
const std::vector<Vertex>& getVertices()
const
233 [[nodiscard]]
const std::vector<unsigned int>& getIndices()
const
242 void updateVertices();
249 std::shared_ptr<BackendTexture> m_svgTexture;
250 std::vector<Vertex> m_vertices;
251 std::vector<unsigned int> m_indices;
253 FloatRect m_visibleRect;
255 Color m_vertexColor = Color::White;
257 float m_rotation = 0;
260 ScalingType m_scalingType = ScalingType::Normal;
Base class for texture implementations that depend on the backend.
Definition BackendTexture.hpp:41
FloatRect getVisibleRect() const
Returns the part of the sprite that is drawn.
float getRotation() const
Gets rotation of the sprite.
void setOpacity(float opacity)
Changes the opacity of the texture.
void setRotation(float angle)
Sets rotation of the sprite.
ScalingType
The way the image should be scaled.
Definition Sprite.hpp:51
float getOpacity() const
Returns the opacity of the texture.
void setSize(Vector2f size)
Changes the size that the image will have when drawing.
Sprite()=default
Default constructor.
ScalingType getScalingType() const
Returns the way in which the image is being scaled.
bool isSet() const
Returns whether a texture was set.
Sprite(Sprite &&) noexcept
Move constructor.
Vector2f getPosition() const
Gets the position of the sprite.
const Texture & getTexture() const
Returns the texture used by this sprite.
void setPosition(Vector2f position)
Sets the position of the sprite.
Sprite(const Texture &texture)
Constructor that immediately sets the texture.
void setTexture(const Texture &texture)
Changes the texture.
void setVisibleRect(const FloatRect &visibleRect)
Changes the part of the sprite that should be drawn.
Vector2f getSize() const
Returns the size that the image has when drawing.
bool isTransparentPixel(Vector2f pos) const
Checks if a certain pixel is transparent.
Sprite(const Sprite &)
Copy constructor.
Texture wrapper that internally reuses resources when multiple Texture objects are loaded from the sa...
Definition Texture.hpp:53
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:37
@ Vertical
Vertical orientation.
Definition Layout.hpp:51
@ Horizontal
Horizontal orientation.
Definition Layout.hpp:52