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

Central gateway subsystem managing UI multi-context lifetimes, resolution scaling, and input filtering. More...

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

+ Collaboration diagram for Flint::UISystem:

Public Member Functions

 UISystem (const UISystem &)=delete
 
UISystem & operator= (const UISystem &)=delete
 
 UISystem (UISystem &&)=delete
 
UISystem & operator= (UISystem &&)=delete
 
FLINT_API UIContext * createContext (std::string name)
 Spawns and registers a uniquely named UI canvas sandbox workspace.
 
FLINT_API void destroyContext (std::string name)
 Completely unloads the targeted context container and immediately releases its bound VRAM elements.
 
FLINT_API UIContext * getContext (const std::string &name) const
 Queries the context map registry to extract a specific UI canvas reference block.
 
FLINT_API UIContext * getActiveContext () const
 Fetches the current user interface workspace layer targeted for frame inputs and draw pipelines.
 
float getDisplayScale () const
 Returns the current resolution scalar factor applied across the layout metric generation loop.
 
FLINT_API void setActiveContext (const std::string &name)
 Switches frame event processing focus directly over to a specific pre-registered context layout tree.
 
FLINT_API void setDisplayScale (float scale)
 Sets the global layout transformation multiplier factor to support clean high-DPI/resolution rendering.
 
FLINT_API void clearActiveContext ()
 De-allocates focus assignments, forcing the active layout view track to return to null.
 
FLINT_API void update (float deltaTime) const
 Advances frame animation trackers and ticking metrics within the currently active UI context tree.
 
FLINT_API void handleEvent (const AppEvent &event)
 Translates raw platform engine input messages into structured, semantic UIEvent actions.
 
FLINT_API void render (UICanvas &canvas) const
 Dispatches the active context layout node tree to push text structures and primitives down to the rendering queue.
 

Detailed Description

Central gateway subsystem managing UI multi-context lifetimes, resolution scaling, and input filtering.

Owned by the main Application layer, Acts as a central router that hosts named user interface trees, scales layout constraints for DPI adjustments, and applies high-speed axis hysteresis to normalize analog hardware inputs into structured UI navigation tokens.

Definition at line 25 of file ui-system.h.

Member Function Documentation

◆ createContext()

FLINT_API UIContext * Flint::UISystem::createContext ( std::string name)

Spawns and registers a uniquely named UI canvas sandbox workspace.

Note
The system assumes absolute unique allocation ownership of the created node map.
Parameters
nameThe identification key token for runtime lookups.
Returns
A safe, non-owning reference pointer to the generated canvas workspace.

◆ destroyContext()

FLINT_API void Flint::UISystem::destroyContext ( std::string name)

Completely unloads the targeted context container and immediately releases its bound VRAM elements.

Warning
If the targets match the current active context pointer, the engine state safely switches back to nullptr.

◆ getActiveContext()

FLINT_API UIContext * Flint::UISystem::getActiveContext ( ) const
nodiscard

Fetches the current user interface workspace layer targeted for frame inputs and draw pipelines.

Returns
Pointer to the active operational UIContext canvas, or nullptr if none is currently focused.

◆ getContext()

FLINT_API UIContext * Flint::UISystem::getContext ( const std::string & name) const
nodiscard

Queries the context map registry to extract a specific UI canvas reference block.

Parameters
nameThe target lookup tracking key string.
Returns
A non-owning pointer to the matching context element, or nullptr if unrecognized.

◆ getDisplayScale()

float Flint::UISystem::getDisplayScale ( ) const
inlinenodiscard

Returns the current resolution scalar factor applied across the layout metric generation loop.

Definition at line 64 of file ui-system.h.

◆ handleEvent()

FLINT_API void Flint::UISystem::handleEvent ( const AppEvent & event)

Translates raw platform engine input messages into structured, semantic UIEvent actions.

This method houses the engine's axis hysteresis state engine. Analog stick deflections from gamepads are parsed against dual boundary limits (Schmitt trigger mechanism), converting continuous float streams into discrete single-fire navigation commands. Cursor sweeps and mechanical button actions skip this filter stage and are forwarded down to the tree elements instantly.

Parameters
eventThe incoming platform-level raw application data wrapper.
See also
UIContext::handleEvent, toUiEvent

◆ render()

FLINT_API void Flint::UISystem::render ( UICanvas & canvas) const

Dispatches the active context layout node tree to push text structures and primitives down to the rendering queue.

Note
Must execute strictly inside a live master frame window block before the geometry layout buffers are synchronized or flushed.
Parameters
rendererThe graphics submission batch instance that transforms node rectangles into physical hardware drawing pipelines.

◆ setActiveContext()

FLINT_API void Flint::UISystem::setActiveContext ( const std::string & name)

Switches frame event processing focus directly over to a specific pre-registered context layout tree.

Note
Activating a new context automatically resets the internal axis deflection state filters.
Parameters
nameThe identifier token string of the targeted context canvas.

◆ setDisplayScale()

FLINT_API void Flint::UISystem::setDisplayScale ( float scale)

Sets the global layout transformation multiplier factor to support clean high-DPI/resolution rendering.

Note
Instantly propagates down into the active context tree view layer to mark text boundaries as dirty.

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