GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::graphics::TextInstance2D Struct Reference

Configuration of a 2D instance of Text2D shaped from a Font2D to draw. More...

#include <GREM/graphics_2d/Instances2D.hpp>

Public Attributes

vec2 position {0.0f, 0.0f}
 Starting position, in world coordinates, to draw the text at.
float angle = 0.0f
 Angle, in radians, to rotate the text counter-clockwise by, around its TextInstance2D::origin.
vec2 scale {1.0f, 1.0f}
 Coefficients to scale the size of the text by.
TextAlign alignment = TextAlign::NONE
 Alignment mode of the text.
vec2 alignmentOffset {0.0f, 0.0f}
 Additional offset to apply to the text after applying the specified alignment.
Color color = Color::WHITE
 Base text color.

Detailed Description

Configuration of a 2D instance of Text2D shaped from a Font2D to draw.

Member Data Documentation

◆ position

vec2 grem::graphics::TextInstance2D::position {0.0f, 0.0f}

Starting position, in world coordinates, to draw the text at.

This will be the first position on the baseline of the first line of text.

◆ angle

float grem::graphics::TextInstance2D::angle = 0.0f

Angle, in radians, to rotate the text counter-clockwise by, around its TextInstance2D::origin.

◆ scale

vec2 grem::graphics::TextInstance2D::scale {1.0f, 1.0f}

Coefficients to scale the size of the text by.

The result is affected by Font2DOptions::useLinearFiltering.

Remarks
The best visual results are usually achieved when the text is shaped at an appropriate character size to begin with, rather than relying on this scale parameter. As such, the scale should generally be kept at (1, 1) unless many different character sizes are used with this font and there is a strict requirement on the maximum size of the texture atlas.

◆ alignment

TextAlign grem::graphics::TextInstance2D::alignment = TextAlign::NONE

Alignment mode of the text.

◆ alignmentOffset

vec2 grem::graphics::TextInstance2D::alignmentOffset {0.0f, 0.0f}

Additional offset to apply to the text after applying the specified alignment.

◆ color

Color grem::graphics::TextInstance2D::color = Color::WHITE

Base text color.


The documentation for this struct was generated from the following file: