|
| Sprite ()=default |
| Default constructor.
|
|
| Sprite (const Texture &texture) |
| Constructor that immediately sets the texture.
|
|
| Sprite (const Sprite &) |
| Copy constructor.
|
|
| Sprite (Sprite &&) noexcept |
| Move constructor.
|
|
| ~Sprite () |
| Destructor.
|
|
Sprite & | operator= (const Sprite &) |
| Overload of copy assignment operator.
|
|
Sprite & | operator= (Sprite &&) noexcept |
| Move assignment.
|
|
void | setTexture (const Texture &texture) |
| Changes the texture.
|
|
const Texture & | getTexture () const |
| Returns the texture used by this sprite.
|
|
bool | isSet () const |
| Returns whether a texture was set.
|
|
void | setSize (Vector2f size) |
| Changes the size that the image will have when drawing.
|
|
Vector2f | getSize () const |
| Returns the size that the image has when drawing.
|
|
void | setOpacity (float opacity) |
| Changes the opacity of the texture.
|
|
float | getOpacity () const |
| Returns the opacity of the texture.
|
|
void | setVisibleRect (const FloatRect &visibleRect) |
| Changes the part of the sprite that should be drawn.
|
|
FloatRect | getVisibleRect () const |
| Returns the part of the sprite that is drawn.
|
|
void | setPosition (Vector2f position) |
| Sets the position of the sprite.
|
|
Vector2f | getPosition () const |
| Gets the position of the sprite.
|
|
void | setRotation (float angle) |
| Sets rotation of the sprite.
|
|
float | getRotation () const |
| Gets rotation of the sprite.
|
|
bool | isTransparentPixel (Vector2f pos) const |
| Checks if a certain pixel is transparent.
|
|
ScalingType | getScalingType () const |
| Returns the way in which the image is being scaled.
|
|
const std::shared_ptr< BackendTexture > & | getSvgTexture () const |
|
const std::vector< Vertex > & | getVertices () const |
|
const std::vector< unsigned int > & | getIndices () const |
|
void | updateVertices () |
|
◆ ScalingType
The way the image should be scaled.
Enumerator |
---|
Normal | The image is not split and scaled normally.
|
Horizontal | Image is split in Left, Middle and Right parts. Left and Right keep ratio, Middle gets stretched.
|
Vertical | Image is split in Top, Middle and Bottom parts. Top and Bottom keep ratio, Middle gets stretched.
|
NineSlice | Image is split in 9 parts. Corners keep size, sides are stretched in one direction, middle is stretched in both directions.
|
◆ Sprite()
tgui::Sprite::Sprite |
( |
const Texture & | texture | ) |
|
Constructor that immediately sets the texture.
- Parameters
-
texture | Texture to use in the sprite |
◆ getOpacity()
float tgui::Sprite::getOpacity |
( |
| ) |
const |
|
nodiscard |
Returns the opacity of the texture.
- Returns
- The opacity of the texture. 0 means completely transparent, while 1 (default) means fully opaque
◆ getPosition()
Vector2f tgui::Sprite::getPosition |
( |
| ) |
const |
|
nodiscard |
Gets the position of the sprite.
- Returns
- Sprite position
◆ getRotation()
float tgui::Sprite::getRotation |
( |
| ) |
const |
|
nodiscard |
Gets rotation of the sprite.
- Returns
- Degrees rotated counterclockwise
◆ getScalingType()
Returns the way in which the image is being scaled.
- Returns
- Scaling type
◆ getSize()
Vector2f tgui::Sprite::getSize |
( |
| ) |
const |
|
nodiscard |
Returns the size that the image has when drawing.
- Returns
- Size of the sprite
◆ getTexture()
const Texture & tgui::Sprite::getTexture |
( |
| ) |
const |
|
nodiscard |
Returns the texture used by this sprite.
- Returns
- Texture of the sprite
◆ getVisibleRect()
FloatRect tgui::Sprite::getVisibleRect |
( |
| ) |
const |
|
nodiscard |
Returns the part of the sprite that is drawn.
- Returns
- Visible part of the sprite
◆ isSet()
bool tgui::Sprite::isSet |
( |
| ) |
const |
|
nodiscard |
Returns whether a texture was set.
- Returns
- Has a valid texture been assigned to this sprite?
◆ isTransparentPixel()
bool tgui::Sprite::isTransparentPixel |
( |
Vector2f | pos | ) |
const |
|
nodiscard |
Checks if a certain pixel is transparent.
- Parameters
-
pos | Coordinate of the pixel |
- Returns
- True when the pixel is transparent, false when it is not
◆ setOpacity()
void tgui::Sprite::setOpacity |
( |
float | opacity | ) |
|
Changes the opacity of the texture.
- Parameters
-
opacity | The opacity of the texture. 0 means completely transparent, while 1 (default) means fully opaque |
The alpha component of the color specified with setColor is multiplied with this factor.
◆ setPosition()
void tgui::Sprite::setPosition |
( |
Vector2f | position | ) |
|
Sets the position of the sprite.
- Parameters
-
position | New sprite position |
◆ setRotation()
void tgui::Sprite::setRotation |
( |
float | angle | ) |
|
Sets rotation of the sprite.
- Parameters
-
angle | Degrees to rotate counterclockwise |
Rotation can currently only be a multiple of 90 degrees.
◆ setSize()
void tgui::Sprite::setSize |
( |
Vector2f | size | ) |
|
Changes the size that the image will have when drawing.
- Parameters
-
◆ setTexture()
void tgui::Sprite::setTexture |
( |
const Texture & | texture | ) |
|
Changes the texture.
- Parameters
-
◆ setVisibleRect()
void tgui::Sprite::setVisibleRect |
( |
const FloatRect & | visibleRect | ) |
|
Changes the part of the sprite that should be drawn.
- Parameters
-
visibleRect | Visible part of the sprite |
Set this to (0, 0, 0, 0) to show the entire sprite
The documentation for this class was generated from the following file: