TextRenderer class
Renders text using font files.
Public static functions
- static auto Get() -> TextRenderer&
- Returns a reference to the singleton
TextRendererinstance.
Public functions
- void Init()
- Initializes the TextRenderer.
- void Shutdown()
- Cleans up the TextRenderer.
- void LoadFont(const std::string& name, const std::string& path, unsigned int font_size)
- Caches a font by name.
- void AddFont(const std::string& name, std::shared_ptr<Font> font)
- Caches an already loaded font resource.
- void DrawText(const std::string& font_name, const std::string& text, const glm::vec2& position, float rotation, float scale, const glm::vec4& color)
- Renders text with full transformation support.
Function documentation
static TextRenderer& engine:: graphics:: TextRenderer:: Get()
Returns a reference to the singleton TextRenderer instance.
| Returns | Reference to the TextRenderer. |
|---|
void engine:: graphics:: TextRenderer:: LoadFont(const std::string& name,
const std::string& path,
unsigned int font_size)
Caches a font by name.
| Parameters | |
|---|---|
| name | The name to associate with the font. |
| path | The file path of the font. |
| font_size | The pixel size to load. |