class TextSprite

Inherits: Sprite

A sprite consisting of a quads representing a text string.

Public

Constructors

TextSprite

TextSprite() = default

Methods

~TextSprite

~TextSprite() noexcept

Update

void Update(const TextSpriteInformation &information, u64 groupId)

Recreates internal sprite data according the specified description structure.

information
Describes the geometry and material of the sprite.
groupId
Group identifier that forces different materials to be used for different groups (for example you don't want the sprites to share the same group if they use different world transform matrices).

staticGetAlignmentOffsets

static void GetAlignmentOffsets(const TextGeometry &textGeometry, u32 width, u32 height, GUIHorizontalTextAlignment horzAlign, GUIVerticalTextAlignment vertAlign, Vector2I *output)

Calculates and returns offset for each individual text line.

The offsets provide information on how much to offset the lines within provided bounds.

textGeometry
Text geometry to generate offsets for.
width
Width of the text bounds into which to constrain the text, in pixels.
height
Height of the text bounds into which to constrain the text, in pixels.
horzAlign
Specifies how is text horizontally aligned within its bounds.
vertAlign
Specifies how is text vertically aligned within its bounds.
output
Pre-allocated buffer to output the results in. Buffer must have an element for every line in .

staticBuildTextQuads

static u32 BuildTextQuads(u32 page, const TextGeometry &textGeometry, u32 width, u32 height, GUIHorizontalTextAlignment horzAlign, GUIVerticalTextAlignment vertAlign, SpriteAnchor anchor, Vector2 *vertices, Vector2 *uv, u32 *indices, u32 bufferSizeQuads)

Calculates text quads you may use for text rendering, based on the specified text data.

Only generates quads for the specified page.

page
Font page to generate the data for.
textGeometry
Text geometry to generate offsets for.
width
Width of the text bounds into which to constrain the text, in pixels.
height
Height of the text bounds into which to constrain the text, in pixels.
horzAlign
Specifies how is text horizontally aligned within its bounds.
vertAlign
Specifies how is text vertically aligned within its bounds.
anchor
Determines how to anchor the text within the bounds.
vertices
Output buffer containing quad positions. Must be allocated and of adequate size.
uv
Output buffer containing quad UV coordinates. Must be allocated and of adequate size. Can be null.
indices
Output buffer containing quad indices. Must be allocated and of adequate size. Can be null.
bufferSizeQuads
Size of the output buffers, in number of quads.

Returns: Number of generated quads.

staticBuildTextQuads

static u32 BuildTextQuads(const TextGeometry &textGeometry, u32 width, u32 height, GUIHorizontalTextAlignment horzAlign, GUIVerticalTextAlignment vertAlign, SpriteAnchor anchor, Vector2 *vertices, Vector2 *uv, u32 *indices, u32 bufferSizeQuads)

Calculates text quads you may use for text rendering, based on the specified text data.

Generates quads for all pages.

textGeometry
Text geometry to generate offsets for.
width
Width of the text bounds into which to constrain the text, in pixels.
height
Height of the text bounds into which to constrain the text, in pixels.
horzAlign
Specifies how is text horizontally aligned within its bounds.
vertAlign
Specifies how is text vertically aligned within its bounds.
anchor
Determines how to anchor the text within the bounds.
vertices
Output buffer containing quad positions. Must be allocated and of adequate size.
uv
Output buffer containing quad UV coordinates. Must be allocated and of adequate size. Can be null.
indices
Output buffer containing quad indices. Must be allocated and of adequate size. Can be null.
bufferSizeQuads
Size of the output buffers, in number of quads.

Returns: Number of generated quads.

Private

Methods

ClearMesh

void ClearMesh()

Clears internal geometry buffers.

Fields

mAlloc

StaticAlloc<kStaticBufferSize> mAlloc