|
Clutter Engine 0.0.1
|
Represents a UI element that displays a textured sprite. Inherits from WidgetElement and provides functionality for rendering a texture. More...
#include <SpriteElement.h>
Public Member Functions | |
| SpriteElement (const std::string textureName, Vector2 size={ 1, 1 }, Vector2 position={ 0, 0 }, int ZOrder=0) | |
| Constructs a SpriteElement with a texture name, size, position, and Z order. | |
| SpriteElement (Vector2 size={ 1, 1 }, Vector2 position={ 0, 0 }, int ZOrder=0) | |
| Constructs a SpriteElement with size, position, and Z order. No texture is set. | |
| SpriteElement (Texture *texture, Vector2 size={ 1, 1 }, Vector2 position={ 0, 0 }, int ZOrder=0) | |
| Constructs a SpriteElement with a texture pointer, size, position, and Z order. | |
| ~SpriteElement ()=default | |
| Destructor for SpriteElement. | |
| virtual Transform2D | GetTransform () const override |
| Gets the transform of the sprite element. | |
| virtual Vector2 | GetSize () const override |
| Gets the size of the sprite element. | |
| virtual void | Update () override |
| Updates the sprite element. (No-op in this implementation.) | |
| virtual void | Draw (RendererGL *renderer) override |
| Draws the sprite element using the provided renderer. | |
| void | SetTexture (Texture *pTexture) |
| Sets the texture for the sprite element. | |
| void | SetTexture (std::string pTexture) |
| Sets the texture for the sprite element by texture name. | |
| Texture * | GetTexture () const |
| Gets the current texture of the sprite element. | |
Public Member Functions inherited from clt::WidgetElement | |
| WidgetElement (Vector2 size={ 1, 1 }, Vector2 position={ 0, 0 }, int ZOrder=0) | |
| Constructs a WidgetElement with given size, position, and Z-order. | |
| ~WidgetElement ()=default | |
| Default destructor. | |
| int | GetZOrder () const |
| Gets the Z-order of the widget. | |
| void | SetZOrder (int ZOrder) |
| Sets the Z-order and updates the widget order in the owner panel. | |
| Vector2 | GetPosition () const |
| Gets the position of the widget. | |
| float | GetRotation () const |
| Gets the rotation of the widget. | |
| void | SetSize (Vector2 size) |
| Sets the size of the widget. | |
| void | SetSize (float size) |
| Sets the size of the widget (uniform scale). | |
| void | SetAnchor (Anchor anchor) |
| Sets the anchor type for the widget. | |
| void | SetPosition (Vector2 position) |
| Sets the position of the widget. | |
| void | SetRotation (float rotation) |
| Sets the rotation of the widget. | |
| void | ToggleVisibility () |
| Toggles the visibility of the widget. | |
Protected Attributes | |
| Texture * | mTexture |
| Pointer to the texture used by this sprite element. | |
Protected Attributes inherited from clt::WidgetElement | |
| Transform2D | mTransform |
| friend | UIPanel |
Additional Inherited Members | |
Public Attributes inherited from clt::WidgetElement | |
| bool | mVisibility |
Protected Member Functions inherited from clt::WidgetElement | |
| void | SetOwner (UIPanel *pOwner) |
| Sets the owner UIPanel of this widget. | |
Represents a UI element that displays a textured sprite. Inherits from WidgetElement and provides functionality for rendering a texture.
|
inline |
Constructs a SpriteElement with a texture name, size, position, and Z order.
| textureName | The name of the texture to use. |
| size | The size of the sprite element. |
| position | The position of the sprite element. |
| ZOrder | The Z order for rendering. |
|
inline |
Constructs a SpriteElement with size, position, and Z order. No texture is set.
| size | The size of the sprite element. |
| position | The position of the sprite element. |
| ZOrder | The Z order for rendering. |
|
inline |
Constructs a SpriteElement with a texture pointer, size, position, and Z order.
| texture | Pointer to the texture to use. |
| size | The size of the sprite element. |
| position | The position of the sprite element. |
| ZOrder | The Z order for rendering. |
|
inlineoverridevirtual |
Draws the sprite element using the provided renderer.
| renderer | The renderer to use for drawing. |
Implements clt::WidgetElement.
Reimplemented in clt::ButtonElement.
|
inlineoverridevirtual |
Gets the size of the sprite element.
Reimplemented from clt::WidgetElement.
|
inline |
Gets the current texture of the sprite element.
|
inlineoverridevirtual |
Gets the transform of the sprite element.
Reimplemented from clt::WidgetElement.
|
inline |
Sets the texture for the sprite element by texture name.
| pTexture | The name of the texture to set. |
|
inline |
Sets the texture for the sprite element.
| pTexture | Pointer to the texture to set. |
|
inlineoverridevirtual |
Updates the sprite element. (No-op in this implementation.)
Reimplemented from clt::WidgetElement.
Reimplemented in clt::ButtonElement, and clt::FlipbookElement.