Skip to content

Class Engine::TextPlugin

ClassList > Engine > TextPlugin

Bundles Text component registration andTextSystem into the ECS.More...

  • #include <TextPlugin.hpp>

Inherits the following classes: Engine::IPlugin

Public Functions

Type Name
virtual void Init (Registry & registry) override
Registers the Text component andTextSystem with the registry.

Public Functions inherited from Engine::IPlugin

See Engine::IPlugin

Type Name
virtual void Init (Registry & registry) = 0
Initializes the plugin, registering components and systems.
virtual ~IPlugin () = default

Public Static Functions

Type Name
void AttachToEntity (Registry & registry, const Entity entity, const std::string & txt)
Attaches a default Text component to an entity.
void AttachToEntity (Registry & registry, const Entity entity, const std::string & txt, float fontSize)
Attaches a Text component with a specified font size to an entity.
void AttachToEntity (Registry & registry, const Entity entity, const std::string & txt, float fontSize, const Position & position)
Attaches a Text component with a specified font size and explicit position.

Detailed Description

Provides convenient helper methods to attach text components to entities with automatic Position validation and default values.

Public Functions Documentation

function Init

Registers the Text component andTextSystem with the registry.

virtual void Engine::TextPlugin::Init (
    Registry & registry
) override

Parameters:

  • registry Main ECS registry.

Implements Engine::IPlugin::Init


Public Static Functions Documentation

function AttachToEntity [⅓]

Attaches a default Text component to an entity.

static void Engine::TextPlugin::AttachToEntity (
    Registry & registry,
    const Entity entity,
    const std::string & txt
) 

Automatically adds a default Position component if the entity does not already possess one.

Parameters:

  • registry Main ECS registry.
  • entity Target entity to attach text to.
  • txt Text content string to display.

function AttachToEntity [⅔]

Attaches a Text component with a specified font size to an entity.

static void Engine::TextPlugin::AttachToEntity (
    Registry & registry,
    const Entity entity,
    const std::string & txt,
    float fontSize
) 

Automatically adds a default Position component if the entity does not already possess one.

Parameters:

  • registry Main ECS registry.
  • entity Target entity to attach text to.
  • txt Text content string to display.
  • fontSize Size of the font in pixels.

function AttachToEntity [3/3]

Attaches a Text component with a specified font size and explicit position.

static void Engine::TextPlugin::AttachToEntity (
    Registry & registry,
    const Entity entity,
    const std::string & txt,
    float fontSize,
    const Position & position
) 

Parameters:

  • registry Main ECS registry.
  • entity Target entity to attach text to.
  • txt Text content string to display.
  • fontSize Size of the font in pixels.
  • position World position for rendering the text.


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