|
Velvet 0.1a
A beginner-friendly C++ GUI framework built on SFML.
|
Text display widget with simple style map support. More...
#include <Label.hpp>
Inheritance diagram for Label:Public Member Functions | |
| void | render (sf::RenderWindow &window) override |
| Render the label. | |
| void | setPosition (float x, float y) override |
| Set top-left position of label text/background. | |
| sf::Vector2f | getDimensions () override |
| Get current text bounds. | |
| Label (std::string text, std::unordered_map< std::string, std::variant< unsigned int, float, std::string > > styling={}) | |
| Create label with text and optional style overrides. | |
| void | setText (const std::string txt) |
| Replace displayed string. | |
| void | overrideStyling (std::unordered_map< std::string, std::variant< unsigned int, float, std::string > > styling) |
| Apply/override style properties. | |
Public Member Functions inherited from Widget | |
| Widget () | |
| Construct a widget with default font loading. | |
| virtual void | handleEvent (const sf::Event &event, sf::RenderWindow &window) |
| Handle an SFML event. | |
Additional Inherited Members | |
Public Attributes inherited from Widget | |
| sf::Font | font |
| Shared font loaded by the base widget. | |
Protected Attributes inherited from Widget | |
| float | x |
| float | y |
Text display widget with simple style map support.
Supported style keys (std::unordered_map<std::string, std::variant<unsigned int, float, std::string>>):
fontPath (std::string)fontSize (float)lineSpacing (float)letterSpacing (float)fillColor (unsigned int, RGBA hex like 0xRRGGBBAA)outlineColor (unsigned int)outlineThickness (float)fontStyle (std::string: regular|bold|italic|underlined|strikethrough)backgroundColor (unsigned int) | Label::Label | ( | std::string | text, |
| std::unordered_map< std::string, std::variant< unsigned int, float, std::string > > | styling = {} |
||
| ) |
Create label with text and optional style overrides.
|
overridevirtual |
Get current text bounds.
Implements Widget.
| void Label::overrideStyling | ( | std::unordered_map< std::string, std::variant< unsigned int, float, std::string > > | styling | ) |
Apply/override style properties.
Unknown keys are ignored with a warning.
|
overridevirtual |
Render the label.
Reimplemented from Widget.
|
overridevirtual |
Set top-left position of label text/background.
Implements Widget.
| void Label::setText | ( | const std::string | txt | ) |
Replace displayed string.