Component that renders a text string, optionally over a background.
More...
#include <textrenderer_component.hpp>
|
| TextRenderer * | tr |
| | Renderer used to draw the text.
|
| |
| std::string | path |
| | Path of the loaded font file.
|
| |
| int | fontHeight |
| | Pixel height the font is loaded at.
|
| |
| Font * | font = nullptr |
| | Loaded font, or nullptr.
|
| |
| Texture * | backTex = nullptr |
| | Optional background texture.
|
| |
Component that renders a text string, optionally over a background.
Loads a font, draws text each frame via the TextRenderer, and can paint a colored or textured background rectangle behind the text.
◆ firstFrame()
| void cangine::TextRendererComponent::firstFrame |
( |
| ) |
|
|
overridevirtual |
◆ frame()
| void cangine::TextRendererComponent::frame |
( |
double |
deltaTime | ) |
|
|
overridevirtual |
Called every frame to update the component.
- Parameters
-
| deltaTime | Seconds elapsed since the previous frame. |
Reimplemented from cangine::IComponent.
◆ getBackTexture()
| Texture * cangine::TextRendererComponent::getBackTexture |
( |
| ) |
const |
Returns the background texture.
- Returns
- Background texture, or
nullptr if unset.
◆ getFontHeight()
| int cangine::TextRendererComponent::getFontHeight |
( |
| ) |
|
Returns the current font pixel height.
- Returns
- Font height in pixels.
◆ getSize()
| Vector2 cangine::TextRendererComponent::getSize |
( |
| ) |
|
Returns the rendered size of the current text.
- Returns
- Width and height the text occupies.
◆ setBackTexture()
| void cangine::TextRendererComponent::setBackTexture |
( |
Texture * |
textureIn | ) |
|
Sets the background texture drawn behind the text.
- Parameters
-
| textureIn | Texture to use, or nullptr for none. |
◆ setFontHeight()
| void cangine::TextRendererComponent::setFontHeight |
( |
int |
heightIn | ) |
|
Sets the font's pixel height (reloads the font).
- Parameters
-
| heightIn | New pixel height. |
◆ backgroundColor
| Color cangine::TextRendererComponent::backgroundColor |
◆ backgroundPadding
| float cangine::TextRendererComponent::backgroundPadding |
Padding between text and background edges.
◆ backTex
| Texture* cangine::TextRendererComponent::backTex = nullptr |
|
protected |
Optional background texture.
◆ color
| Color cangine::TextRendererComponent::color |
◆ font
| Font* cangine::TextRendererComponent::font = nullptr |
|
protected |
◆ fontHeight
| int cangine::TextRendererComponent::fontHeight |
|
protected |
Pixel height the font is loaded at.
◆ path
| std::string cangine::TextRendererComponent::path |
|
protected |
Path of the loaded font file.
◆ rect
| Rectangle cangine::TextRendererComponent::rect |
Background rectangle geometry.
◆ scale
| float cangine::TextRendererComponent::scale |
Scale factor applied to the text.
◆ text
| std::string cangine::TextRendererComponent::text |
◆ tr
Renderer used to draw the text.
The documentation for this class was generated from the following files: