Text.Add

static void Add(string text, Matrix transform, TextStyle style, TextAlign position, TextAlign align, float offX, float offY, float offZ)

   
string text What text should be drawn?
Matrix transform A Matrix representing the transform of the text mesh! Try Matrix.TRS.
TextStyle style Style information for rendering, see Text.MakeStyle or the TextStyle object.
TextAlign position How should the text’s bounding rectangle be positioned relative to the transform?
TextAlign align How should the text be aligned within the text’s bounding rectangle?
float offX An additional offset on the X axis.
float offY An additional offset on the Y axis.
float offZ An additional offset on the Z axis.

Renders text at the given location! Must be called every frame you want this text to be visible.

static void Add(string text, Matrix transform, TextAlign position, TextAlign align, float offX, float offY, float offZ)

   
string text What text should be drawn?
Matrix transform A Matrix representing the transform of the text mesh! Try Matrix.TRS.
TextAlign position How should the text’s bounding rectangle be positioned relative to the transform?
TextAlign align How should the text be aligned within the text’s bounding rectangle?
float offX An additional offset on the X axis.
float offY An additional offset on the Y axis.
float offZ An additional offset on the Z axis.

Renders text at the given location! Must be called every frame you want this text to be visible.

Examples

Drawing text with and without a TextStyle

Basic text We can use a TextStyle object to control how text gets displayed!

TextStyle style;

In initialization, we can create the style from a font, a size, a material, and a base color.

style = Text.MakeStyle(
    Font.FromFile("C:/Windows/Fonts/Arial.ttf"), 
    2 * U.cm,
lt.MaterialFont.Copy(), 
    Color.HSV(0.05f, 0.7f, 0.8f));

Then it’s pretty trivial to just draw some text on the screen! Just call Text.Add on update. If you don’t have a TextStyle available, calling it without one will just fall back on the default style.

// Text with an explicit text style
Text.Add(
    "Here's\nSome\nMulti-line\nText!!", 
    Matrix.TRS(new Vec3(0.1f, 0, 0), Quat.LookDir(0, 0, 1)),
    style);
// Text using the default text style
Text.Add(
    "Here's\nSome\nMulti-line\nText!!", 
    Matrix.TRS(new Vec3(-0.1f, 0, 0), Quat.LookDir(0, 0, 1)));