Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
Flint::UIContext Class Reference

Manages an isolated user interface canvas workspace sandbox, hosting its own independent node tree and interaction state trackers. More...

#include <flint/ui/ui-context.h>

+ Collaboration diagram for Flint::UIContext:

Public Member Functions

 UIContext (std::string name)
 Instantiates a named user interface workspace canvas.
 
 UIContext (const UIContext &)=delete
 
UIContext & operator= (const UIContext &)=delete
 
 UIContext (UIContext &&)=delete
 
UIContext & operator= (UIContext &&)=delete
 
const std::string & getName () const
 Returns the identifier lookup key string assigned to this workspace context layer.
 
void setRoot (std::unique_ptr< UINode > root)
 Sets the root node of the UI hierarchy.
 
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.
 
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.
 
UINode * findById (const std::string &id) const
 Performs a linear tree-search traversal to locate a specific element matching the provided identifier token.
 
UINode * getHoveredNode () const
 Returns a non-owning pointer to the interactive widget currently sitting directly beneath the mouse cursor bounding box.
 
UINode * getFocusedNode () const
 Returns a non-owning pointer to the interactive widget currently holding active keyboard or gamepad directional input priorities.
 
UIInputMode getInputMode () const
 Extracts the persistent context tracking mode used to choose visual layouts and prompt glyph representations.
 
void setFocusedNode (UINode *node)
 Explicitly shifts directional focus priorities straight to a target element node.
 
void clearFocus ()
 Strips focus flags cleanly away from all active tree elements, returning the canvas interaction state back to resting values.
 
void setDisplayScale (float scale)
 Sets a local resolution scale coefficient factor to properly offset layout metrics for DPI matching targets.
 
void setInputMode (UIInputMode mode)
 Modifies the active user interaction mode tracker state context.
 
float getDisplayScale () const
 Extracts the local scale coefficient factor used to translate base pixel assets for resolution alignment metrics.
 
void addTexture (std::shared_ptr< GPUTexture > tex)
 
std::unique_ptr< UINode > releaseRoot ()
 

Detailed Description

Manages an isolated user interface canvas workspace sandbox, hosting its own independent node tree and interaction state trackers.

UIContext represents a distinct UI layout layer (such as a Main Menu, Pause Overlay, or HUD). It handles specialized spatial queries like pointer hit-testing, orchestrates keyboard/gamepad focus tree navigation, and triggers the top-level dual-pass layout pipeline initialization during the frame's rendering cycle.

Definition at line 27 of file ui-context.h.


The documentation for this class was generated from the following file: