7#include <aegis2d/ui/export.hpp>
94 [[nodiscard]] std::size_t
size() const noexcept;
118 [[nodiscard]] render::Rect bounds(
WidgetId id) const;
138 void set_scale(
float scale,
Vec2 origin = {0.0F, 0.0F})
noexcept;
142 [[nodiscard]]
float scale() const noexcept;
147 [[nodiscard]]
Vec2 scaled(
Vec2 point) const noexcept;
161 void clear_focus() noexcept;
169 bool focus_previous();
197 std::vector<WidgetId> children;
202 [[nodiscard]]
const Node& node(
WidgetId id)
const;
203 [[nodiscard]] Node& node(
WidgetId id);
204 [[nodiscard]] std::vector<WidgetId> focus_order(
bool everything =
false)
const;
205 bool step_focus(
bool forward);
207 std::vector<Node> nodes_;
208 std::optional<WidgetId> focused_;
210 Vec2 origin_{0.0F, 0.0F};
Vector and matrix types of the engine (GLM behind engine names).
Menus and forms: widgets and their focus, moved by keyboard, gamepad and mouse (client only).
Definition console.hpp:21
Direction
Direction the focus moves in, with the arrows, the D-pad or a stick.
Definition widget_tree.hpp:24
@ Down
Towards the bottom of the screen.
@ Up
Towards the top of the screen.
@ Right
Towards the right of the screen.
@ Left
Towards the left of the screen.
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
glm::vec2 Vec2
2D vector of floats: positions, velocities, sizes (glm::vec2).
Definition math.hpp:19
Definition endpoint.hpp:85
Backend-independent renderer interface and the sprite it draws.
Axis-aligned rectangle.
Definition renderer.hpp:20
What the player asked of the focus during a frame.
Definition widget_tree.hpp:37
bool activate
Use the focused widget (Enter, Space, South), pressed during the frame.
Definition widget_tree.hpp:49
bool previous
Focus the previous widget (Shift+Tab, left shoulder).
Definition widget_tree.hpp:41
std::optional< Vec2 > pointer
Where the mouse points, in logical pixels, when it moved or clicked.
Definition widget_tree.hpp:45
std::optional< Direction > direction
Focus the nearest widget in a direction.
Definition widget_tree.hpp:43
bool click
The main mouse button went down at the pointer.
Definition widget_tree.hpp:47
bool held
The activate key or button, or the main mouse button, is held down.
Definition widget_tree.hpp:51
bool next
Focus the next widget (Tab, right shoulder).
Definition widget_tree.hpp:39