6#include "../../render/renderer/text_renderer.hpp"
7#include "../../util/color.hpp"
8#include "../../shapes/shapes.hpp"
9#include "../../render/texture.hpp"
35 void frame(
double dt)
override;
Base interface for all components attached to a GameObject.
Definition component.hpp:17
Component that renders a text string, optionally over a background.
Definition textrenderer_component.hpp:18
float backgroundPadding
Padding between text and background edges.
Definition textrenderer_component.hpp:29
int getFontHeight()
Returns the current font pixel height.
Definition textrenderer_component.cpp:99
Font * font
Loaded font, or nullptr.
Definition textrenderer_component.hpp:23
Texture * getBackTexture() const
Returns the background texture.
Definition textrenderer_component.cpp:106
std::string text
The string to render.
Definition textrenderer_component.hpp:31
std::string path
Path of the loaded font file.
Definition textrenderer_component.hpp:21
void setBackTexture(Texture *textureIn)
Sets the background texture drawn behind the text.
Definition textrenderer_component.cpp:102
Vector2 getSize()
Returns the rendered size of the current text.
Definition textrenderer_component.cpp:92
void firstFrame() override
Called once before the first frame update.
Definition textrenderer_component.cpp:12
int fontHeight
Pixel height the font is loaded at.
Definition textrenderer_component.hpp:22
Color color
Text color.
Definition textrenderer_component.hpp:27
Rectangle rect
Background rectangle geometry.
Definition textrenderer_component.hpp:32
void setFontHeight(int heightIn)
Sets the font's pixel height (reloads the font).
Definition textrenderer_component.cpp:95
float scale
Scale factor applied to the text.
Definition textrenderer_component.hpp:30
TextRenderer * tr
Renderer used to draw the text.
Definition textrenderer_component.hpp:20
Color backgroundColor
Background fill color.
Definition textrenderer_component.hpp:28
Texture * backTex
Optional background texture.
Definition textrenderer_component.hpp:24
void frame(double dt) override
Called every frame to update the component.
Definition textrenderer_component.cpp:59
Singleton that loads fonts and renders text via FreeType.
Definition text_renderer.hpp:62
Wraps an OpenGL texture object.
Definition texture.hpp:12
Definition audiomanager.cpp:4
RGBA color stored as normalized floating-point components.
Definition color.hpp:12
A loaded font face plus its cache of rasterized glyphs.
Definition text_renderer.hpp:33
An axis-aligned rectangle with a position, size and color.
Definition rectangle.hpp:21
Two-component floating-point vector.
Definition vector2.hpp:13