TimeFormatterComponent Class
Component that formats elapsed or remaining time into a display string. More...
Declaration
Public Member Functions Index
| void | setFormat (std::string format, const TimeDisplayMode displayMode=TimeDisplayMode::Elapsed) |
|
Sets the format string and display mode. More... | |
| std::string | format (const float elapsed, const float duration=0) const |
|
Formats the given time values into a display string. More... | |
Private Member Attributes Index
| std::string | format_ |
|
The format string used by std::vformat (expects minutes, seconds). More... | |
| TimeDisplayMode | displayMode_ = TimeDisplayMode::Elapsed |
|
The active display mode (elapsed or remaining). More... | |
Description
Component that formats elapsed or remaining time into a display string.
Holds a format string compatible with std::vformat and a TimeDisplayMode. The format string receives two integer arguments: minutes and seconds.
- See Also
- See Also
GameTimer2UiTextUpdateSystem
Definition at line 27 of file TimeFormatterComponent.ixx.
Public Member Functions
format()
| inline |
Formats the given time values into a display string.
If duration is zero, the display mode falls back to Elapsed.
- Parameters
-
elapsed Elapsed time in seconds.
duration Total duration in seconds. Zero disables Remaining mode.
- Returns
The formatted time string.
Definition at line 66 of file TimeFormatterComponent.ixx.
References helios::engine::modules::ui::layout::types::Elapsed and helios::engine::modules::ui::layout::types::Remaining.
Referenced by setFormat.
setFormat()
| inline |
Sets the format string and display mode.
- Parameters
-
format A std::vformat-compatible string (e.g. "{:02d}:{:02d}").
displayMode The display mode to use. Defaults to Elapsed.
Definition at line 51 of file TimeFormatterComponent.ixx.
References helios::engine::modules::ui::layout::types::Elapsed and format.
Private Member Attributes
displayMode_
| mutable |
The active display mode (elapsed or remaining).
Declared mutable because format() may fall back to Elapsed when duration is zero.
Definition at line 40 of file TimeFormatterComponent.ixx.
format_
|
The format string used by std::vformat (expects minutes, seconds).
Definition at line 32 of file TimeFormatterComponent.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.