5#include "flint/core/api.h"
6#include "flint/graphics/gpu/gpu-texture.h"
7#include "flint/ui/ui-event.h"
8#include "flint/ui/ui-node.h"
41 [[nodiscard]] FLINT_API
const std::string &
getName()
const;
52 FLINT_API
void setRoot(std::unique_ptr<UINode> root);
59 FLINT_API
void update(
float deltaTime);
122 if (m_displayScale != scale) {
123 m_displayScale = scale;
124 m_layoutDirty =
true;
134 return m_displayScale;
137 void addTexture(std::shared_ptr<GPUTexture> tex) {
138 m_textures.push_back(std::move(tex));
141 std::unique_ptr<UINode> releaseRoot() {
142 m_hoveredNode =
nullptr;
143 m_focusedNode =
nullptr;
145 return std::move(m_root);
151 [[nodiscard]] UINode *findByIdRecursive(UINode *node,
const std::string &
id)
const;
155 UINode *getNavigationStartNode(
const std::vector<UINode *> &focusable)
const;
163 UINode *findHitNode(UINode *node, Vec2f point);
166 std::unique_ptr<UINode> m_root;
168 mutable bool m_layoutDirty =
true;
169 mutable Vec2f m_lastLayoutSize;
171 std::vector<std::shared_ptr<GPUTexture>> m_textures;
173 UINode *m_hoveredNode =
nullptr;
174 UINode *m_focusedNode =
nullptr;
175 float m_displayScale = 1.f;
176 UIInputMode m_inputMode = UIInputMode::Mouse;
Dynamic 2D batching engine processing shape vector geometry and hardware-accelerated text strings....
Manages an isolated user interface canvas workspace sandbox, hosting its own independent node tree an...
FLINT_API UIInputMode getInputMode() const
Extracts the persistent context tracking mode used to choose visual layouts and prompt glyph represen...
float getDisplayScale() const
Extracts the local scale coefficient factor used to translate base pixel assets for resolution alignm...
FLINT_API void update(float deltaTime)
Advances internal animation chronometers or custom ticking scripts linked across the canvas layer.
void setDisplayScale(float scale)
Sets a local resolution scale coefficient factor to properly offset layout metrics for DPI matching t...
FLINT_API UIContext(std::string name)
Instantiates a named user interface workspace canvas.
FLINT_API void setInputMode(UIInputMode mode)
Modifies the active user interaction mode tracker state context.
FLINT_API const std::string & getName() const
Returns the identifier lookup key string assigned to this workspace context layer.
FLINT_API void setRoot(std::unique_ptr< UINode > root)
Sets the root node of the UI hierarchy.
FLINT_API UINode * getHoveredNode() const
Returns a non-owning pointer to the interactive widget currently sitting directly beneath the mouse c...
FLINT_API void render(UICanvas &canvas) const
Intercepts semantic UI framework event packets to calculate canvas spatial routing updates.
FLINT_API UINode * getRoot() const
Extracts a non-owning pointer to the base root element layout tracking map.
FLINT_API void setFocusedNode(UINode *node)
Explicitly shifts directional focus priorities straight to a target element node.
FLINT_API UINode * findById(const std::string &id) const
Performs a linear tree-search traversal to locate a specific element matching the provided identifier...
FLINT_API void handleEvent(const UIEvent &event)
Intercepts semantic UI framework event packets to calculate canvas spatial routing updates.
FLINT_API UINode * getFocusedNode() const
Returns a non-owning pointer to the interactive widget currently holding active keyboard or gamepad d...
FLINT_API void clearFocus()
Strips focus flags cleanly away from all active tree elements, returning the canvas interaction state...
Abstract base class for all UI widgets, managing hierarchy tracking, layout passes,...
A normalized data packet containing translated input data routed down the UI node tree.