|
| LabelEntity (const sf::Font &font, AxisType type, sf::Vector2f initialPosition) |
| Constructs a LabelEntity with a given font, axis orientation and initial position.
|
virtual | ~LabelEntity ()=default |
| Virtual destructor.
|
float | getValue () const |
| Returns the numeric value associated with the label.
|
unsigned int | getCharacterSize () const |
| Returns the current character size of the label text.
|
int | getDecimalPlaces () const |
| Returns the number of decimal places currently used for numeric formatting.
|
void | setFont (const sf::Font &font) |
| Sets a new font for the label.
|
void | setLabelText (std::string text) |
| Defines the text content of the label.
|
void | setCharacterSize (unsigned int newSize) |
| Sets a new character size for the labels.
|
void | setDecimalPlaces (int places) |
| Sets the number of decimal places for numeric labels.
|
void | setCustomLabels (const std::string &labels) |
| Sets a custom label string.
|
bool | usesCustomLabels () const |
| Indicates whether the entity is currently using custom labels.
|
std::string | formatLabel (float value) |
| Formats a numeric value into a label string.
|
void | render (sf::RenderWindow &window) |
| Renders the label on the given SFML 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 or a collection of axis labels.
A LabelEntity manages the rendering of formatted text associated with axis notches. Labels can be generated dynamically (from numeric values, with controlled precision) or defined manually via custom strings.
The class relies on SFML's sf::Text for rendering and provides customization of style (font, color, character size) and placement (axis orientation, offset relative to the axis).
- Note
- Typically, a LabelEntity is aggregated inside an AxisEntity to display labels alongside axis notches.
- See also
- AxisEntity
- Author
- Wilfried Koch
- Copyright
- © 2025 Wilfried Koch. All rights reserved.