|
Clutter Engine 0.0.1
|
UI element for rendering text. More...
#include <TextElement.h>
Public Member Functions | |
| TextElement (std::string text="Hello World !", std::string font="BebasNeue", Color color=Color::White, float textSize=1, Vector2 position={ 0, 0 }, int ZOrder=0) | |
| Constructs a TextElement with specified text, font name, color, size, position, and Z order. | |
| TextElement (std::string text, Color color, float textSize=1, Vector2 position={ 0, 0 }, int ZOrder=0) | |
| Constructs a TextElement with specified text, color, size, position, and Z order. | |
| TextElement (std::string text, Font *font, Color color=Color::White, float textSize=1, Vector2 position={ 0, 0 }, int ZOrder=0) | |
| Constructs a TextElement with specified text, font pointer, color, size, position, and Z order. | |
| ~TextElement () | |
| Destructor for TextElement. | |
| void | SetText (std::string text) |
| Sets the text to display. | |
| void | SetText (int text) |
| Sets the text to display using an integer value. | |
| void | SetSize (float size) |
| Sets the size of the text. | |
| void | SetColor (Color color) |
| Sets the color of the text. | |
| void | SetAlignment (TextAlignment alignment) |
| Sets the alignment of the text. | |
| float | GetTextWidth () const |
| Gets the width of the rendered text. | |
| virtual void | Draw (RendererGL *renderer) override |
| Draws the text element using the specified renderer. | |
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. | |
| virtual void | Update () |
| Updates the widget element. Override in derived classes. | |
| 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. | |
| virtual Vector2 | GetSize () const |
| Gets the size of the widget. | |
| Vector2 | GetPosition () const |
| Gets the position of the widget. | |
| float | GetRotation () const |
| Gets the rotation of the widget. | |
| virtual Transform2D | GetTransform () const |
| Gets the transform 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. | |
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. | |
Protected Attributes inherited from clt::WidgetElement | |
| Transform2D | mTransform |
| friend | UIPanel |
UI element for rendering text.
TextElement allows displaying and customizing text in the UI, including font, color, size, and alignment.
| TextElement::TextElement | ( | std::string | text = "Hello World !", |
| std::string | font = "BebasNeue", | ||
| Color | color = Color::White, | ||
| float | textSize = 1, | ||
| Vector2 | position = { 0, 0 }, | ||
| int | ZOrder = 0 ) |
Constructs a TextElement with specified text, font name, color, size, position, and Z order.
| text | The text to display. |
| font | The font name to use. |
| color | The color of the text. |
| textSize | The size of the text. |
| position | The position of the text element. |
| ZOrder | The Z order for rendering. |
| TextElement::TextElement | ( | std::string | text, |
| Color | color, | ||
| float | textSize = 1, | ||
| Vector2 | position = { 0, 0 }, | ||
| int | ZOrder = 0 ) |
Constructs a TextElement with specified text, color, size, position, and Z order.
| text | The text to display. |
| color | The color of the text. |
| textSize | The size of the text. |
| position | The position of the text element. |
| ZOrder | The Z order for rendering. |
| TextElement::TextElement | ( | std::string | text, |
| Font * | font, | ||
| Color | color = Color::White, | ||
| float | textSize = 1, | ||
| Vector2 | position = { 0, 0 }, | ||
| int | ZOrder = 0 ) |
Constructs a TextElement with specified text, font pointer, color, size, position, and Z order.
| text | The text to display. |
| font | Pointer to the font to use. |
| color | The color of the text. |
| textSize | The size of the text. |
| position | The position of the text element. |
| ZOrder | The Z order for rendering. |
|
overridevirtual |
Draws the text element using the specified renderer.
| renderer | The renderer to use for drawing. |
Implements clt::WidgetElement.
|
inline |
Gets the width of the rendered text.
| void TextElement::SetAlignment | ( | TextAlignment | alignment | ) |
Sets the alignment of the text.
| alignment | The new text alignment. |
| void TextElement::SetColor | ( | Color | color | ) |
Sets the color of the text.
| color | The new color. |
| void TextElement::SetSize | ( | float | size | ) |
Sets the size of the text.
| size | The new text size. |
| void TextElement::SetText | ( | int | text | ) |
Sets the text to display using an integer value.
| text | The integer to convert and display as text. |
| void TextElement::SetText | ( | std::string | text | ) |
Sets the text to display.
| text | The new text string. |