27#include "guillaume/ecs/component_registry.hpp"
28#include "guillaume/entities/builder_base.hpp"
29#include "guillaume/ecs/entity_builder.hpp"
30#include "guillaume/ecs/entity_filler.hpp"
32#include "guillaume/components/bound.hpp"
33#include "guillaume/components/text.hpp"
34#include "guillaume/components/typography.hpp"
35#include "guillaume/components/transform.hpp"
36#include "guillaume/components/color.hpp"
38#include "guillaume/theme/typescale.hpp"
83 components::Text, components::Color,
84 components::Typography>
91 enum class Type { Normal, Condensed, Monospace, Serif, Slab };
101 std::string _content;
106 utility::graphic::Color32Bit _color;
131 void reset(
void)
override;
182 std::shared_ptr<Text>
183 makeText(std::shared_ptr<Entity> parent,
184 const std::string &content,
const float &fontSize,
185 const utility::graphic::Color32Bit &color);
198 std::shared_ptr<Text>
199 makeText(std::shared_ptr<Entity> parent,
201 const utility::graphic::Color32Bit &color);
217 template<
typename... Arguments>
218 static std::shared_ptr<Text>
create(Arguments &&...arguments)
220 std::shared_ptr<Text> entity(
221 new Text(std::forward<Arguments>(arguments)...));
273 Text &
setColor(
const utility::graphic::Color32Bit &color);
293 void applyTypography(
void);
305 const float &fontSize,
const utility::graphic::Color32Bit &color);
318 std::optional<float> fontSize = std::nullopt);
Which typescale role a text uses (BodyMedium, TitleLarge, ...) and an optional explicit size.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
The base class of a widget without children: an Entity that creates its components when it is constru...
Owns entities and gives the systems the list of entities to visit.
EntityBuilderBase(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
Builder & withFontSize(const float &fontSize)
Override the role font size with an explicit size.
Builder(ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
Construct a builder holding the defaults of reset().
std::shared_ptr< Text > buildEntity(void) override
Build a text from the current configuration, without registering it or giving it a parent.
void reset(void) override
Restore the defaults: empty content, role BodyMedium, no explicit font size, and the OnSurface color ...
Builder & withTypeRole(theme::TypeRole role)
Set the typescale role and drop any explicit font size.
std::shared_ptr< Text > makeText(std::shared_ptr< Entity > parent, const std::string &content, const float &fontSize, const utility::graphic::Color32Bit &color)
Build a text with an explicit font size, register it under parent and reset the builder.
Builder & withContent(const std::string &content)
Set the characters to draw.
Builder & withColor(const utility::graphic::Color32Bit &color)
Set the text color.
A single run of text drawn with a typescale role, a color and an optional explicit font size.
Type
Font family kinds. No function of the library reads this enumeration.
Text & setContent(const std::string &content)
Replace the characters to draw.
theme::TypeRole getTypeRole(void) const
Get the typescale role the text is styled with.
Text & setFontSize(const float &fontSize)
Override the role font size with an explicit size.
Text & setTypeRole(theme::TypeRole role)
Set the typescale role and drop any explicit font size.
static std::shared_ptr< Text > create(Arguments &&...arguments)
Build a text without registering it in an entity registry.
Text & setColor(const utility::graphic::Color32Bit &color)
Set the text color.
Widgets: the classes used to create entities with the right components and children.
TypeRole
The named text styles of Material Design 3: what a piece of text is, not how big it is.