Table of Contents

Class TextElement

Namespace
Stride.CommunityToolkit.Rendering.Text
Assembly
Stride.CommunityToolkit.dll

One line of on-screen text: what it says, its colour, and, for a help line, the keys it is about.

public record TextElement : IEquatable<TextElement>
Inheritance
TextElement
Implements

Remarks

A help line names its keys as data rather than in the text - new("H", "Reset camera"), not new("[H] Reset camera") - and the DebugOverlay decorates them when it draws, with KeyFormat and in KeyColor. Changing the whole toolkit from [H] to H: is then one property, not an edit to every example.

Constructors

TextElement(IReadOnlyList<string>, string, Color?)

A help line about several keys that do the same thing: new(["Q", "E"], "Ascend / descend").

public TextElement(IReadOnlyList<string> keys, string text, Color? color = null)

Parameters

keys IReadOnlyList<string>

The keys, in the order they are drawn.

text string

What they do, capitalised like a sentence.

color Color?

The optional color for the text.

TextElement(string, Color?)

One line of on-screen text: what it says, its colour, and, for a help line, the keys it is about.

public TextElement(string Text, Color? Color = null)

Parameters

Text string

The text content to be displayed.

Color Color?

The optional color for the text. If null, a default color will be used.

Remarks

A help line names its keys as data rather than in the text - new("H", "Reset camera"), not new("[H] Reset camera") - and the DebugOverlay decorates them when it draws, with KeyFormat and in KeyColor. Changing the whole toolkit from [H] to H: is then one property, not an edit to every example.

TextElement(string, string, Color?)

A help line about one key: new("H", "Reset camera").

public TextElement(string key, string text, Color? color = null)

Parameters

key string

The key, as a reader would say it: "H", "Space", "Mouse wheel".

text string

What the key does, capitalised like a sentence.

color Color?

The optional color for the text.

Properties

Color

The optional color for the text. If null, a default color will be used.

public Color? Color { get; init; }

Property Value

Color?

Indented

Whether the line is drawn one marker in, so its keys sit under the key of a title with a marker. The overlay sets it for the body of a collapsible section; a dropdown sets it on its items.

public bool Indented { get; init; }

Property Value

bool

Keys

The keys the line is about, drawn before the text and decorated by the overlay: "H", "Space", "Arrow keys"; several when they do the same thing, drawn as [Q] [E].

public IReadOnlyList<string>? Keys { get; init; }

Property Value

IReadOnlyList<string>

Marker

A state marker drawn before the keys, in the key colour and as given: a collapsible section's [+] or [-]. Not decorated like a key, since it is not one.

public string? Marker { get; init; }

Property Value

string

Text

The text content to be displayed.

public string Text { get; init; }

Property Value

string