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

Configuration of a copied 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 copy, and later 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 copied 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.
Unlike TextInstance, this instance type does not require the given text to remain valid for the duration of its use in the RenderPass, since the RenderPass stores a copy of the text when it is drawn.
See also
TextInstance
TextUTF8StringInstance
TextStringInstance
Examples
example_game.cpp.

Member Data Documentation

◆ shader

Shader2D* donut::graphics::TextCopyInstance::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::TextCopyInstance::text

Non-owning read-only pointer to the shaped text to copy, and later draw.

Warning
All of the fonts used by the text must remain valid for the duration of their use in the RenderPass.
Must not be nullptr.
Examples
example_game.cpp.

◆ position

vec2 donut::graphics::TextCopyInstance::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::TextCopyInstance::color = Color::WHITE

Base text color.


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