TextRenderableConfig Class
Fluent configuration for text renderable GameObjects. More...
Declaration
Public Constructors Index
| TextRenderableConfig (helios::engine::ecs::GameObject gameObject) | |
|
Constructs a TextRenderableConfig for the given GameObject. More... | |
Public Member Functions Index
| TextRenderableConfig & | shader (const std::shared_ptr< helios::ext::opengl::rendering::shader::LegacyOpenGLShader > &shader) |
|
Sets the shader for text rendering. More... | |
| TextRenderableConfig & | color (const helios::math::vec4f color) |
|
Sets the text color. More... | |
| SceneNodeConfig | attachTo (helios::engine::ecs::GameObject parent) |
|
Builds the text renderable and attaches to a parent GameObject. More... | |
| SceneNodeConfig | attachTo (helios::scene::SceneNode *parent) |
|
Builds the text renderable and attaches to a parent SceneNode. More... | |
| TextRenderableConfig & | fontResourceProvider (helios::rendering::text::FontResourceProvider &provider) |
|
Sets the font resource provider. More... | |
| TextRenderableConfig & | asUiText () |
|
Configures this text as a UI text component. More... | |
| TextRenderableConfig & | formattedAsNumber (std::string numberFormat="{:.0f}") |
|
Attaches a NumberFormatterComponent with the given format. More... | |
| TextRenderableConfig & | formattedAsTimestamp (std::string timestampFormat) |
|
Attaches a TimeFormatterComponent with the given format. More... | |
| TextRenderableConfig & | useElapsedLabel (std::string label) |
|
Sets the label shown instead of "00:00" when remaining time reaches zero. More... | |
| TextRenderableConfig & | hideWhenZero () |
|
Hides the time output when remaining time reaches zero. More... | |
| TextRenderableConfig & | displayRemaining () |
|
Switches the time formatter to display remaining time. More... | |
| TextRenderableConfig & | text (std::string text) |
|
Sets the text content. More... | |
| TextRenderableConfig & | fontId (helios::engine::modules::ui::widgets::types::FontId fontId) |
|
Sets the font identifier. More... | |
| TextRenderableConfig & | fontScale (const float fontScale) |
|
Sets the font scale factor. More... | |
| TextRenderableConfig & | build () |
|
Builds the text renderable and adds components to the GameObject. More... | |
Private Member Attributes Index
| helios::engine::ecs::GameObject | gameObject_ |
|
The GameObject being configured. More... | |
| helios::rendering::text::FontResourceProvider * | fontResourceProvider_ |
|
Pointer to the font resource provider. More... | |
| std::shared_ptr< helios::ext::opengl::rendering::shader::LegacyOpenGLShader > | shader_ |
|
The shader used for text rendering. More... | |
| helios::math::vec4f | color_ |
|
The text color. More... | |
| std::string | text_ |
|
The text content to display. More... | |
| float | fontScale_ |
|
The font scale factor. More... | |
| std::string | numberFormat_ = "{:0.f}" |
|
Format string for number display (std::vformat syntax). More... | |
| bool | isUiText_ = false |
|
Whether this text should be configured as UI text. More... | |
| helios::engine::modules::ui::widgets::types::FontId | fontId_ {helios::core::types::no_init} |
|
The font identifier. More... | |
| std::string | timestampFormat_ |
|
Format string for timestamp display (std::vformat syntax). More... | |
| bool | usesTimeFormatter_ |
|
Whether a TimeFormatterComponent should be attached. More... | |
| bool | usesNumberFormatter_ |
|
Whether a NumberFormatterComponent should be attached. More... | |
| bool | displayRemaining_ |
|
Whether the timer should display remaining instead of elapsed time. More... | |
| std::string | elapsedLabel_ |
|
Label displayed instead of "00:00" when remaining time reaches zero. More... | |
| bool | showElapsedLabel_ = false |
|
True if an elapsed label has been configured. More... | |
| bool | hideWhenZero_ = false |
|
True if the output should be empty when remaining time reaches zero. More... | |
Description
Fluent configuration for text renderable GameObjects.
Provides a builder-style interface for configuring text rendering properties including font, color, shader, and optional UI text binding.
Definition at line 36 of file TextRenderableConfig.ixx.
Public Constructors
TextRenderableConfig()
| inline explicit |
Constructs a TextRenderableConfig for the given GameObject.
- Parameters
-
<a href="/docs/helios/namespaces/helios/engine/builder/gameobject">gameObject</a> The GameObject to configure.
Definition at line 127 of file TextRenderableConfig.ixx.
Referenced by asUiText, build, color, displayRemaining, fontId, fontResourceProvider, fontScale, formattedAsNumber, formattedAsTimestamp, hideWhenZero, shader, text and useElapsedLabel.
Public Member Functions
asUiText()
| inline |
Configures this text as a UI text component.
- Returns
Reference to this config for method chaining.
Definition at line 210 of file TextRenderableConfig.ixx.
Reference TextRenderableConfig.
attachTo()
| inline |
Builds the text renderable and attaches to a parent GameObject.
- Parameters
-
parent The parent GameObject to attach to.
- Returns
A SceneNodeConfig for further configuration.
Definition at line 164 of file TextRenderableConfig.ixx.
References build and helios::engine::builder::gameObject::builders::configs::SceneNodeConfig::parent.
attachTo()
| inline |
Builds the text renderable and attaches to a parent SceneNode.
- Parameters
-
parent The parent SceneNode to attach to.
- Returns
A SceneNodeConfig for further configuration.
Definition at line 182 of file TextRenderableConfig.ixx.
References build and helios::engine::builder::gameObject::builders::configs::SceneNodeConfig::parent.
build()
| inline |
Builds the text renderable and adds components to the GameObject.
Creates a TextRenderable with the configured properties and adds RenderableComponent and ModelAabbComponent. If configured as UI text, also adds UiTextComponent.
- Returns
Reference to this config for method chaining.
Definition at line 333 of file TextRenderableConfig.ixx.
References helios::engine::modules::ui::layout::types::Elapsed, helios::engine::modules::ui::layout::types::Remaining, helios::engine::modules::ui::layout::components::TimeFormatterComponent::setFormat and TextRenderableConfig.
color()
| inline |
Sets the text color.
- Parameters
-
color The RGBA color.
- Returns
Reference to this config for method chaining.
Definition at line 151 of file TextRenderableConfig.ixx.
References color and TextRenderableConfig.
Referenced by color.
displayRemaining()
| inline |
Switches the time formatter to display remaining time.
Only effective when formattedAsTimestamp() has been called.
- Returns
Reference to this config for method chaining.
Definition at line 282 of file TextRenderableConfig.ixx.
Reference TextRenderableConfig.
fontId()
| inline |
Sets the font identifier.
- Parameters
-
fontId The font ID to use.
- Returns
Reference to this config for method chaining.
Definition at line 307 of file TextRenderableConfig.ixx.
References fontId and TextRenderableConfig.
Referenced by fontId.
fontResourceProvider()
| inline |
Sets the font resource provider.
- Parameters
-
provider The font resource provider.
- Returns
Reference to this config for method chaining.
Definition at line 200 of file TextRenderableConfig.ixx.
Reference TextRenderableConfig.
fontScale()
| inline |
Sets the font scale factor.
- Parameters
-
fontScale The scale factor.
- Returns
Reference to this config for method chaining.
Definition at line 319 of file TextRenderableConfig.ixx.
References fontScale and TextRenderableConfig.
Referenced by fontScale.
formattedAsNumber()
| inline |
Attaches a NumberFormatterComponent with the given format.
Implicitly enables UI text mode.
- Parameters
-
numberFormat A std::vformat-compatible string. Defaults to "{:.0f}".
- Returns
Reference to this config for method chaining.
Definition at line 224 of file TextRenderableConfig.ixx.
Reference TextRenderableConfig.
formattedAsTimestamp()
| inline |
Attaches a TimeFormatterComponent with the given format.
Implicitly enables UI text mode.
- Parameters
-
timestampFormat A std::vformat-compatible string expecting minutes and seconds.
- Returns
Reference to this config for method chaining.
Definition at line 239 of file TextRenderableConfig.ixx.
Reference TextRenderableConfig.
hideWhenZero()
| inline |
Hides the time output when remaining time reaches zero.
Only effective in Remaining mode. When enabled, format() returns an empty string once the remaining time is exhausted.
- Returns
Reference to this config for method chaining.
Definition at line 270 of file TextRenderableConfig.ixx.
Reference TextRenderableConfig.
shader()
| inline |
Sets the shader for text rendering.
- Parameters
-
shader The shader to use.
- Returns
Reference to this config for method chaining.
Definition at line 138 of file TextRenderableConfig.ixx.
References shader and TextRenderableConfig.
Referenced by shader.
text()
| inline |
Sets the text content.
- Parameters
-
text The text to display.
- Returns
Reference to this config for method chaining.
Definition at line 295 of file TextRenderableConfig.ixx.
References text and TextRenderableConfig.
Referenced by text.
useElapsedLabel()
| inline |
Sets the label shown instead of "00:00" when remaining time reaches zero.
Only effective in Remaining mode. Once the remaining time drops to one second or below, format() returns this label instead of the numeric output.
- Parameters
-
label The label string to display (e.g. "TIME UP").
- Returns
Reference to this config for method chaining.
Definition at line 256 of file TextRenderableConfig.ixx.
Reference TextRenderableConfig.
Private Member Attributes
color_
|
The text color.
Definition at line 56 of file TextRenderableConfig.ixx.
displayRemaining_
|
Whether the timer should display remaining instead of elapsed time.
Definition at line 101 of file TextRenderableConfig.ixx.
elapsedLabel_
|
Label displayed instead of "00:00" when remaining time reaches zero.
Definition at line 106 of file TextRenderableConfig.ixx.
fontId_
|
The font identifier.
Definition at line 81 of file TextRenderableConfig.ixx.
fontResourceProvider_
|
Pointer to the font resource provider.
Definition at line 46 of file TextRenderableConfig.ixx.
fontScale_
|
gameObject_
|
The GameObject being configured.
Definition at line 41 of file TextRenderableConfig.ixx.
hideWhenZero_
|
True if the output should be empty when remaining time reaches zero.
Definition at line 116 of file TextRenderableConfig.ixx.
isUiText_
|
Whether this text should be configured as UI text.
Definition at line 76 of file TextRenderableConfig.ixx.
numberFormat_
|
Format string for number display (std::vformat syntax).
Definition at line 71 of file TextRenderableConfig.ixx.
shader_
|
The shader used for text rendering.
Definition at line 51 of file TextRenderableConfig.ixx.
showElapsedLabel_
|
True if an elapsed label has been configured.
Definition at line 111 of file TextRenderableConfig.ixx.
text_
|
The text content to display.
Definition at line 61 of file TextRenderableConfig.ixx.
timestampFormat_
|
Format string for timestamp display (std::vformat syntax).
Definition at line 86 of file TextRenderableConfig.ixx.
usesNumberFormatter_
|
Whether a NumberFormatterComponent should be attached.
Definition at line 96 of file TextRenderableConfig.ixx.
usesTimeFormatter_
|
Whether a TimeFormatterComponent should be attached.
Definition at line 91 of file TextRenderableConfig.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.