Skip to content

Struct Engine::Text

ClassList > Engine > Text

Component representing 2D renderable text in the ECS. More...

  • #include <Text.hpp>

Public Attributes

Type Name
Color color = WHITE
Tint color of the text.
Font font = {}
Raylib Font asset used for rendering (default font if texture.id == 0).
std::string fontPath = ""
Path to custom font file (relative to project).
float fontsize = 10.0f
Font size in pixels.
float spacing = 1.0f
Spacing between characters.
std::string text = ""
Content string to display.

Public Functions

Type Name
Text (std::string Text="", float Fontsize=10.0f, Color tint=WHITE, std::string FontPath="")
Constructs a Text component with default font.
Text (Font font, std::string Text, float Fontsize, float Spacing, Color tint, std::string FontPath="")
Constructs a Text component with a custom font and character spacing.

Detailed Description

Holds string content, font reference, font size, character spacing, and tint color. Rendered by TextSystem at the entity's Position.

Public Attributes Documentation

variable color

Tint color of the text.

Color Engine::Text::color;


variable font

Raylib Font asset used for rendering (default font if texture.id == 0).

Font Engine::Text::font;


variable fontPath

Path to custom font file (relative to project).

std::string Engine::Text::fontPath;


variable fontsize

Font size in pixels.

float Engine::Text::fontsize;


variable spacing

Spacing between characters.

float Engine::Text::spacing;


variable text

Content string to display.

std::string Engine::Text::text;


Public Functions Documentation

function Text [½]

Constructs a Text component with default font.

inline Engine::Text::Text (
    std::string Text="",
    float Fontsize=10.0f,
    Color tint=WHITE,
    std::string FontPath=""
) 

Parameters:

  • Text The text string to be displayed.
  • Fontsize The size of the text in pixels.
  • tint The color tint for rendering.
  • FontPath Optional path to custom font file.

function Text [2/2]

Constructs a Text component with a custom font and character spacing.

inline Engine::Text::Text (
    Font font,
    std::string Text,
    float Fontsize,
    float Spacing,
    Color tint,
    std::string FontPath=""
) 

Parameters:

  • font The Raylib Font asset to use.
  • Text The text string to be displayed.
  • Fontsize The size of the text in pixels.
  • Spacing The space between characters in pixels.
  • tint The color tint for rendering.
  • FontPath Optional path to custom font file.


The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Components/Text.hpp