Classes¶
UI/Label
Brief descriptions¶
Structures |
|
Encapsulates text symbol data. |
|
Encapsulates text line data. |
|
Encapsulates text block (a collection of text lines) data. |
|
Classes |
|
Manages a text block. |
Detailed information¶
ui::SymbolParams¶
engine/core/modules/ui/include/nau/ui/label.h
-
struct SymbolParams¶
ui::FontLetterDefinition¶
engine/core/modules/ui/include/nau/ui/label.h
-
struct FontLetterDefinition¶
ui::SymbolDefinition¶
engine/core/modules/ui/include/nau/ui/label.h
-
struct SymbolDefinition¶
Encapsulates text symbol data.
Public Members
-
char32_t utf32Code = 0xFFFFFFFF¶
Symbol UTF-32 code.
-
FontLetterDefinition letterDefinition = {}¶
-
SymbolParams richParams = {}¶
-
char32_t utf32Code = 0xFFFFFFFF¶
ui::TextLineDefinition¶
engine/core/modules/ui/include/nau/ui/label.h
-
struct TextLineDefinition¶
Encapsulates text line data.
Public Members
-
float lineWidth = {0.0f}¶
-
float lineMaxHeight = {0.0f}¶
-
bool IsCustomAlignment = {false}¶
-
HorizontalAlignment Alignment = {}¶
-
std::vector<SymbolDefinition> symbolDefinitions = {}¶
A collection of per-symbol data.
-
float lineWidth = {0.0f}¶
ui::TextDefinition¶
engine/core/modules/ui/include/nau/ui/label.h
-
struct TextDefinition¶
Encapsulates text block (a collection of text lines) data.
Public Functions
-
inline TextDefinition(std::vector<TextLineDefinition> &lines, float height)¶
Public Members
-
std::vector<TextLineDefinition> lineDefinitions = {}¶
A collection of per-line data.
-
float totalTextHeight = {0.0f}¶
-
inline TextDefinition(std::vector<TextLineDefinition> &lines, float height)¶
ui::NauLabel¶
engine/core/modules/ui/include/nau/ui/label.h
-
class NauLabel : public nau::ui::Node¶
Manages a text block.
Public Types
-
enum class LabelType¶
Enumerates text label font types.
Values:
-
enumerator ttf¶
True type.
-
enumerator bmfont¶
Bitmap font.
-
enumerator ttf¶
Public Functions
-
NauLabel()¶
Default constructor.
-
virtual ~NauLabel()¶
Destructor.
-
void addFont(const std::string &fontFilePath)¶
-
void removeFont(const std::string &fontFilePath)¶
-
void setText(const eastl::string &text)¶
Changes the content of the text label.
- Parameters:
text – [in] Text to assign.
-
eastl::string_view getText() const¶
Retrieves the content of the text label.
- Returns:
Text block contained in the label.
-
void updateLabel()¶
Commits changes and updates the label visuals.
-
void enableRichText(bool enable)¶
Turns rich text parsing for the text label on or off.
- Parameters:
enable – [in] Indicates whether rich text parsing should be turned on or off.
-
void setSymbolFactory(eastl::unique_ptr<SymbolFactory> &&symbolFactory)¶
-
void setVerticalAlignment(VerticalAlignment alignment)¶
Changes the label text vertical alignment type.
- Parameters:
alignment – [in] Text vertical elignment type to use.
-
void setHorizontalAlignment(HorizontalAlignment alignment)¶
Changes the label text horizontal alignment type.
- Parameters:
alignment – [in] Text horizontal elignment type to use.
-
void setWrapping(Wrapping wrapping)¶
Changes the label text wrapping mechanism.
- Parameters:
wrapping – [in] Text wrapping mechaninsm to use.
-
void setOverflowType(Overflow overflow)¶
Changes the label overflow strategy.
- Parameters:
overflow – [in] Overflow strategy to use.
-
virtual void setColor(const nau::math::E3DCOLOR &color) override¶
-
virtual void setOpacity(uint8_t opacity) override¶
-
virtual void setCascadeColorEnabled(bool cascadeColorEnabled) override¶
-
virtual void setCascadeOpacityEnabled(bool cascadeOpacityEnabled) override¶
-
virtual void redrawDebug() override¶
Public Static Functions
-
static NauLabel *create(const eastl::string &text, const std::string &fontPath)¶
Creates a text label.
- Parameters:
text – [in] Label text.
fontPath – [in] Path to the font file to use for the label.
- Returns:
A pointer to the created label.
-
static NauLabel *create(const eastl::string &text, const std::string &fontPath, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, Overflow overflow, Wrapping wrapping)¶
Creates a text label.
- Parameters:
text – [in] Label text.
fontPath – [in] Path to the font file to use for the label.
horizontalAlignment – [in] Indicates how to align the text along horizontal axis within the label.
verticalAlignment – [in] Indicates how to align the text along vertical axis within the label.
overflow – [in] Text line overflow strategy to use.
wrapping – [in] Text line wrapping mechanism to use.
- Returns:
A pointer to the created label.
-
static NauLabel *create(eastl::unique_ptr<SymbolFactory> symbolFactory)¶
Protected Functions
-
void setupLetter(const SymbolDefinition &definition, int letterIndex, float renderX, float renderY)¶
-
void setupImage(const SymbolDefinition &definition, int letterIndex, float x, float y)¶
-
float getLineHorizontalOffset(float lineWidth)¶
-
float getLineVerticalOffset(const std::vector<TextLineDefinition> &lineDefinitions, size_t lineIndex, float totalHeight)¶
-
bool isCharacterOverflow(float x, float y, float letterWidth, float letterHeight)¶
-
bool isWrappingToNextLine(char32_t character, FontLetterDefinition &letterDef, float currentLineWidth, float nextWordLenght)¶
-
void hideLettersSprite()¶
-
float getNextWordLenght(const eastl::u32string &utf32Text, size_t startIndex, const std::u32string &font)¶
-
bool isCharacterEndOfWord(char32_t character)¶
-
void setLetterColor(Sprite *letterSprite, const SymbolParams ¶ms)¶
-
void removeSpacesAtEdges(std::vector<SymbolDefinition> &symbolDefinitions)¶
Private Functions
-
void drawText(const std::vector<TextLineDefinition> &lineDefinitions, float totalLinesHeight)¶
-
TextDefinition calculateTextDefinition(const eastl::u32string &text)¶
Private Members
-
HorizontalAlignment m_horizontalAlignment = {HorizontalAlignment::left}¶
-
VerticalAlignment m_verticalAlignment = {VerticalAlignment::top}¶
-
eastl::unique_ptr<SymbolFactory> m_symbolFactory = {}¶
-
eastl::string m_utf8Text = {}¶
-
eastl::u32string m_utf32Text = {}¶
-
bool m_isRichText = {true}¶
-
enum class LabelType¶