Label
Generated from engine/render/label.h at f525bc6. The text under each declaration is the header's own comment, word for word. About the reference says how these pages are made.
Audience: game code.
#include "engine/render/label.h" · namespace labrador
class Label
Section titled “class Label”A string a scene can hold, which is what Text on its own is not.
Text is the drawing half - a wide string, a font handle, a measurement and a draw(). What it does not have is the three things engine/core/game_object.h asks for: something to step, an extent to cull against, and the GameObject base that lets a container hold it next to a sprite.
It is a separate class rather than a base added to Text, and that is not a style choice: engine/ui pairs a GameObject-derived UiWidget with the drawable (UiText is UiWidget plus Text), so a GameObject base on Text would give UiText two of them. This is the same pairing Visual already is for sprites - GameObject plus TextureObject - and for the same reason.
IT HAS NO HIDDEN FLAG, AND SCENE TEXT THAT HIDES IS A UiText. A string a scene holds that must stop drawing while keeping its words, its box and its colour is a UiText (engine/ui/widget.h), whose set_hidden skips the draw and leaves bounds() alone. For a label whose box may go empty, set_text(L"") is the supported way to hide it; it re-measures on every call, so a caller that would do it every frame gates it on a change, as LineSweeper's play state does. Naming UiText here is a pointer and not a dependency: engine/render does not include engine/ui.
const std::string& font_name, float scale = 1.0f, float rotation = 0.0f, float layer_depth = 0.0f);The parameters, what is borrowed and what throws are Text's constructor's (engine/render/text.h).
update
Section titled “update”void update(float dt) override;Nothing to step. A label that animates is a label something else moves, which is what set_position is for.
One declaration overriding two virtuals, because GameObject::draw and TextObject::draw have the same signature in unrelated bases - without it, this class is abstract and the call is ambiguous.
bounds
Section titled “bounds”The drawn box: TextObject::text_bounds, which scales and turns the stored measurement at the current scale and rotation. The measurement is taken when the string or the font changes and not here: this is the culling path, and measuring walks the string. A scale or rotation change takes no measurement and needs none.
Related types
Section titled “Related types”Named in the public declarations above: Colour, DrawList, GameObject, RectangleF, RenderResources, Text, Vector2F.
In the samples and tests
Section titled “In the samples and tests”The files that include this header directly. A file can also reach it through another header.
samples/audio/audio_state.hsamples/linesweeper/states/play_state.hsamples/linesweeper/web/pacing_state.cppsamples/minimal/states/hello_state.htests/linesweeper/frame_allocation_tests.cpptests/render/label_tests.cpptests/scene/cull_tests.cpp
Explained in
Section titled “Explained in”- Drawing, views and cameras
- Read your starter's C++
- Reading the C++ in minimal
- Names, handles and resources
- Input
- Settings and saves
- Sprites and text
- Animate a sprite sheet
- A camera that follows the player
- Put collision in your game
- Copy the components into your game
- Fonts and text in your game
- Add a second level
- Make a title menu
- Put a picture in your game
- Add a rule and a test
- Add a screen to your game
- Save settings in your game
- Play sounds from an XWB bank
- Two players in your game
- Colours, the window and the background
Documentation for Labrador v0.4.0. Built from Labrador f525bc6 of 2026-11-17.