Represents a textual label (typically an axis title or main plot title) in a 2D plot.
More...
|
| TitleEntity (const sf::Font &font, const std::string &title, bool hasFrame=false) |
| Constructs a title entity with specified font and text (UTF-8).
|
| TitleEntity (const sf::Font &font, const std::wstring &title, bool hasFrame=false) |
| Constructs a title entity with specified font and wide string (UTF-16/32).
|
virtual | ~TitleEntity ()=default |
| Virtual destructor.
|
unsigned int | getCharacterSize () const |
| Returns the current character size.
|
sf::FloatRect | getTextSize () const |
| Returns the local bounding box of the title text.
|
void | setTextColor (sf::Color textColor) |
| Sets the text color.
|
void | setOffset (sf::Vector2f offset) |
| Sets the offset relative to the base anchor position.
|
void | setCharacterSize (unsigned int size) |
| Sets the font size (character size) of the title.
|
void | setFont (const sf::Font &font) |
| Sets the font reference for the title.
|
sf::Color | getFrameOutlineColor () const |
| Returns the current outline color of the frame.
|
sf::Color | getFrameFillColor () const |
| Returns the current fill color of the frame.
|
float | getFrameThickness () const |
| Returns the frame's outline thickness.
|
sf::Vector2f | getPadding () const |
| Returns the internal padding of the frame.
|
bool | isFrameEnabled () const |
| Returns whether the title has a visible frame.
|
void | setFrameEnabled (bool enabled) |
| Enables or disables the visual frame.
|
void | setFrameOutlineColor (const sf::Color &color) |
| Sets the frame's outline color.
|
void | setFrameFillColor (const sf::Color &color) |
| Sets the fill color of the frame.
|
void | setFrameThickness (float thickness) |
| Sets the thickness of the frame's outline.
|
void | setPadding (sf::Vector2f padding) |
| Sets the internal padding of the frame (horizontal and vertical).
|
void | render (sf::RenderWindow &window) |
| Renders the title and its frame (if enabled) to the window.
|
| Entity () |
virtual | ~Entity () |
unsigned int | getEntityID () const |
| Returns the unique ID associated with this entity.
|
void | clearComponents () |
| Removes all components currently attached to the entity.
|
template<typename T, typename... Args> |
std::shared_ptr< T > | addComponent (Args &&... args) |
| Adds a new component of type T to the entity.
|
template<typename T> |
void | removeComponent () |
| Removes the component of type T from the entity.
|
template<typename T> |
bool | hasComponent () const noexcept |
| Checks whether the entity has a component of type T.
|
template<typename T> |
std::shared_ptr< T > | getComponent () const |
| Retrieves the component of type T attached to the entity.
|
template<typename T> |
std::shared_ptr< T > | requireComponent (const std::string &context="") const |
| Retrieves the component of type T and throws if it's missing.
|
template<typename Interface> |
std::shared_ptr< Interface > | getInterfaceComponent () const |
| Returns the first component that implements the specified interface.
|
Represents a textual label (typically an axis title or main plot title) in a 2D plot.
A TitleEntity displays text using SFML's sf::Text, styled and positioned using ECS components (PositionComponent, OffsetComponent, ColorComponent, FontComponent). Optionally, it can display a surrounding rectangular frame (FrameEntity) with customizable outline, fill color, thickness, and padding.
Notes:
- The font passed to the constructor must remain valid during the lifetime of the entity (SFML does not copy font data).
- The frame is disabled by default unless explicitly enabled at construction or later.
- See also
- FrameEntity, AxisEntity, GraphicsEntity
- Author
- Wilfried Koch
- Copyright
- © 2025 Wilfried Koch. All rights reserved.