11#include <aegis2d/ui/export.hpp>
86 [[nodiscard]] const
std::
string& text() const noexcept;
90 void set_text(
std::
string text);
94 [[nodiscard]]
std::
size_t cursor() const noexcept;
106 bool update(
Navigation& navigation, const platform::TextInput& input,
107 const platform::Keyboard& keyboard, const
WidgetTree& tree);
114 void draw(render::IRenderer& renderer, const
WidgetTree& tree, const render::BitmapFont& font,
118 void insert(std::string_view utf8);
123 std::size_t cursor_ = 0;
124 bool was_focused_ =
false;
Text drawn with a bitmap font, through the sprite batcher.
An editable line of text, as a widget of a WidgetTree.
Definition text_field.hpp:69
TextField(WidgetTree &tree, render::Rect bounds, TextFieldConfig config={}, WidgetId group=root)
Adds the field to a tree.
WidgetId id() const noexcept
The field's widget in its tree.
RGBA color used by the renderer.
Keyboard keys, their names, and the state of the keyboard during a frame.
Vector and matrix types of the engine (GLM behind engine names).
constexpr Color rgb(std::uint32_t hex, float alpha=1.0F) noexcept
Color from its hexadecimal sRGB code, as design tools and palettes give it.
Definition color.hpp:25
Menus and forms: widgets and their focus, moved by keyboard, gamepad and mouse (client only).
Definition console.hpp:21
std::size_t WidgetId
Identifier of a widget in its WidgetTree, given by WidgetTree::add().
Definition widget_tree.hpp:18
constexpr WidgetId root
The root group of every tree, which the other widgets go under.
Definition widget_tree.hpp:21
Definition endpoint.hpp:85
Backend-independent renderer interface and the sprite it draws.
RGBA color with components in [0, 1].
Definition color.hpp:10
Axis-aligned rectangle.
Definition renderer.hpp:20
What the player asked of the focus during a frame.
Definition widget_tree.hpp:37
Starting text, placeholder and limit of a TextField.
Definition text_field.hpp:21
std::string text
Text the field starts with, cut at max_length.
Definition text_field.hpp:23
std::string placeholder
Shown dimmed while the field is empty.
Definition text_field.hpp:25
std::size_t max_length
Most characters (code points) the field holds, at least 1.
Definition text_field.hpp:27
Colors, text size and layer of a TextField.
Definition text_field.hpp:31
render::Color text
The typed text.
Definition text_field.hpp:39
std::int32_t layer
Layer of the background; the text and the cursor go one layer above.
Definition text_field.hpp:51
render::Color cursor
The cursor, drawn while the field is focused.
Definition text_field.hpp:43
render::Color background
Background of the field.
Definition text_field.hpp:33
render::Color focused
Background of the focused field.
Definition text_field.hpp:35
float text_scale
Scale of the text at 100%, multiplied by the tree's scale.
Definition text_field.hpp:49
float outline_width
Width of the outline and the cursor, in logical pixels at 100%.
Definition text_field.hpp:47
render::Color placeholder
The placeholder, while the field is empty.
Definition text_field.hpp:41
render::Color disabled
Background of a disabled field.
Definition text_field.hpp:37
render::Color outline
Outline around the focused field.
Definition text_field.hpp:45
UTF-8 text typed during a frame, following the user's keyboard layout.