25#ifndef TGUI_SPRITE_HPP
26#define TGUI_SPRITE_HPP
28#include <TGUI/Texture.hpp>
29#include <TGUI/Vector2.hpp>
30#include <TGUI/Rect.hpp>
31#include <TGUI/Color.hpp>
32#include <TGUI/RenderStates.hpp>
216 TGUI_NODISCARD const std::shared_ptr<
BackendTexture>& getSvgTexture()
const
225 TGUI_NODISCARD
const std::vector<Vertex>& getVertices()
const
234 TGUI_NODISCARD
const std::vector<unsigned int>& getIndices()
const
243 void updateVertices();
250 std::shared_ptr<BackendTexture> m_svgTexture;
251 std::vector<Vertex> m_vertices;
252 std::vector<unsigned int> m_indices;
254 FloatRect m_visibleRect;
256 Color m_vertexColor = Color::White;
258 float m_rotation = 0;
261 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:52
@ Vertical
Image is split in Top, Middle and Bottom parts. Top and Bottom keep ratio, Middle gets stretched.
Definition Sprite.hpp:55
@ Normal
The image is not split and scaled normally.
Definition Sprite.hpp:53
@ Horizontal
Image is split in Left, Middle and Right parts. Left and Right keep ratio, Middle gets stretched.
Definition Sprite.hpp:54
@ NineSlice
Image is split in 9 parts. Corners keep size, sides are stretched in one direction,...
Definition Sprite.hpp:56
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:52
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36