Class Label
- Namespace
- RichHudFramework.UI
- Assembly
- RichHudClient.dll
A HUD element dedicated to rendering formatted RichText. This element acts as a wrapper for the underlying TextBoard.
public class Label : LabelElementBase, IReadOnlyHudElement, IReadOnlyHudNode, IReadOnlyHudParent, IMinLabelElement
- Inheritance
-
Label
- Implements
- Derived
- Inherited Members
Examples
The following example creates a Label attached to HighDpiRoot, with centered text aligned to the top of the screen.
var label = new Label(HudMain.HighDpiRoot)
{
ParentAlignment = ParentAlignments.Top,
Padding = new Vector2(20f),
Format = GlyphFormat.White.WithAlignment(TextAlignment.Center),
Text = "This unlined text will appear at the top of the screen."
};
Remarks
Label is a non-interactive, text-only HUD element dedicated to rendering formatted RichText. It acts as a high-level wrapper, bridging the underlying text renderer with the UI graph through an internal ITextBoard.
This UI element handles drawing text with bounding and clipping, and facilitates text manipulation through convenience properties like Text and BuilderMode. For direct access to the underlying rendering and formatting interface, use the TextBoard property.
Constructors
Label()
public Label()
Label(HudParentBase)
public Label(HudParentBase parent)
Parameters
parentHudParentBase
Properties
AutoResize
If true, the size of this UI element will automatically adjust to match the size of the text. True by default.
public bool AutoResize { get; set; }
Property Value
BuilderMode
Gets or sets the text composition mode, which controls how text is arranged (e.g., single line, wrapped, etc.).
public TextBuilderModes BuilderMode { get; set; }
Property Value
Format
Gets or sets the default glyph formatting (font, style, size, color) applied to text that does not have specific formatting defined.
public GlyphFormat Format { get; set; }
Property Value
LineWrapWidth
Gets or sets the maximum width of a line before the text wraps to the next line.
Note: The BuilderMode must be set to Wrapped for this to take effect.
public float LineWrapWidth { get; set; }
Property Value
Text
Gets or sets the rich text content displayed by the label.
public RichText Text { get; set; }
Property Value
TextBoard
Gets the ITextBoard backing this element, which handles the low-level text rendering and layout logic.
public override ITextBoard TextBoard { get; }
Property Value
VertCenterText
If true, the text will be vertically centered within the bounds of the element. True by default.
public bool VertCenterText { get; set; }