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