libdonut  2.3.2
Application framework for cross-platform game development in C++20
Public Attributes | List of all members
donut::graphics::TextInstance Struct Reference

Configuration of a 2D instance of Text shaped from a Font, for drawing as part of a RenderPass. More...

#include <donut/graphics/RenderPass.hpp>

Public Attributes

Shader2Dshader = Shader2D::ALPHA
 Non-owning pointer to the shader to use when rendering the glyphs of this text. More...
 
const Texttext
 Non-owning read-only pointer to the shaped text to draw. More...
 
vec2 position {0.0f, 0.0f}
 Starting position, in world coordinates, to render the text at. More...
 
Color color = Color::WHITE
 Base text color. More...
 

Detailed Description

Configuration of a 2D instance of Text shaped from a Font, for drawing as part of a RenderPass.

Required fields:

Note
Consecutive text instances with the same shader and font will be batched and rendered together.
See also
TextCopyInstance
TextUTF8StringInstance
TextStringInstance
Examples
example_game.cpp.

Member Data Documentation

◆ shader

Shader2D* donut::graphics::TextInstance::shader = Shader2D::ALPHA

Non-owning pointer to the shader to use when rendering the glyphs of this text.

Warning
The pointed-to shader must remain valid for the duration of its use in the RenderPass, and must not be nullptr.

◆ text

const Text* donut::graphics::TextInstance::text

Non-owning read-only pointer to the shaped text to draw.

Warning
The pointed-to text, as well as all of the fonts used by it, must remain valid for the duration of its use in the RenderPass, and must not be nullptr.
Examples
example_game.cpp.

◆ position

vec2 donut::graphics::TextInstance::position {0.0f, 0.0f}

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

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

◆ color

Color donut::graphics::TextInstance::color = Color::WHITE

Base text color.


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