class

CMiriGraphicsScreenStack

Runtime owner of the live game-UI overlays. Scans a World for MiriGraphicsComponents, hosts code-driven Push/Pop screens next to them, instantiates each visible one from its .ui asset, composites them (ZOrder-sorted) into a single overlay the host mounts into its Miri root, re-resolves data bindings every Tick, routes widget events to the host's event sink and drives directional (gamepad/keyboard) focus navigation.

Module
MiriGraphics
Header
#include "MiriGraphics/CMiriGraphicsScreenStack.h"
Namespace
Mowo

Type aliases

AliasDescription
using FWorldQuadSink = std::function<void(const FMiriGraphicsWorldQuad&)>The true-3D path: for every visible worldSpace UIWorldWidgetComponent, (re-)renders its tree into an offscreen texture at a distance-driven LOD resolution — only when the widget is dirty or its LOD bucket moved, so an idle nameplate never re-renders — computes its billboard/oriented world quad, and hands each quad to sink for the host to submit to the scene renderer. Widgets with worldSpace = false are skipped here (drive them through SyncWorldWidgets instead). No-ops without a world-widget renderer.
using FPointerSink = std::function<void(EMiriGraphicsPointerOp op, const Miri::MiriVec2& position)>
using FBackHandler = std::function<bool()>

Constructors

SignatureNameDescription
CMiriGraphicsScreenStack()CMiriGraphicsScreenStack
~CMiriGraphicsScreenStack()~CMiriGraphicsScreenStack
CMiriGraphicsScreenStack(const CMiriGraphicsScreenStack&) = deleteCMiriGraphicsScreenStack

Public functions

ReturnsNameDescription
CMiriGraphicsScreenStack&operator=
voidSetPathResolverResolves a serialized asset path ("Assets/UI/x.ui") to something LoadFromFile can open.
voidSetFocusSinkWhere directional nav sends the newly focused widget (host wires this to its Miri input processor's SetFocus).
voidSetBindingResolverSupplies the current value for a widget data-binding source.
voidSetEventSinkReceives (widgetName, eventName, action) for every authored widget event that fires.
voidInstallVfsPathResolverConvenience installers so every host mounts identically.
voidInstallBridgeFocusSink
voidInstallWorldBindingResolver
voidEnableHotReloadWatches every loaded .ui file and rebuilds its screens on save.
uint32_tLoadLocalizationLoads <rootDir>/<locale>/*.txt string tables (key=value lines, file stem = namespace) into Miri's CTextLocalizationManager and makes the locale current, so authored text_key props resolve through CText::FromKey.
boolSetProjectThemeTheme every screen without its own theme: resolves colour tokens against.
const FMiriGraphicsTheme&GetActiveTheme
voidSetSafeZoneInsetsTitle-safe insets as a fraction of each axis, applied by every screen's root canvas (the designer's Safe Area overlay draws the same box).
voidSetSafeInsetsPer-side insets for THIS stack only (one split-screen viewport, one PIE window).
voidClearSafeInsets
voidSyncFromWorld
voidSyncWorldWidgetsPlaces every visible UIWorldWidgetComponent's tree at its entity's projected screen position.
voidSyncWorldWidgets3D
voidMarkWorldWidgetDirtyMarks a world widget's offscreen texture stale so the next SyncWorldWidgets3D re-renders it.
voidRecordPendingWorldWidgets
FMiriGraphicsWorldHitHitTestWorldWidgetsRay-vs-quad hit test against the interactive world-widget quads resolved by the last SyncWorldWidgets3D, nearest hit first.
boolRouteWorldWidgetClickRay-picks the nearest interactive world widget and dispatches a synthetic left click (button down + up) to the widget under the mapped local point, exactly as if the user had clicked that pixel of the offscreen tree.
voidClear
int32_tPushScreenCode-driven screens (pause menu, main menu, loading).
boolPopScreen
boolPopTopScreen
int32_tPushScreenOnLayerLayer-addressed push: the layer picks the z band and whether the screen is modal ("game", "menu", "modal", "toast" — see FMiriGraphicsScreenLayers).
int32_tPopLayer
int32_tCountOnLayer
boolIsScreenMounted
std::stringGetScreenPath
voidSetScreenBackHandlerBack for one screen instance; runs before the global handler when that screen is the top code-driven one.
boolAttachViewModelThe per-instance state of a pushed screen: "self.<field>" bindings read it, so two copies of one asset hold separate values.
std::shared_ptr<FMiriGraphicsViewModel>GetViewModel
int32_tPushScreenWithViewModel
boolSetWidgetTextOnScreenHandle-addressed twins of the path-addressed setters above: they reach the instance, not the first screen that happens to share the asset.
Miri::TSharedPtr<Miri::MWidget>FindNamedOnScreen
boolSetWidgetVisibleOnScreen
boolSetWidgetProgressOnScreen
boolHasModalScreen
int32_tPushedCount
boolPlayAnimationTimeline playback on a mounted screen (world-scanned or pushed), addressed by its asset path.
boolPlayAnimation
boolStopAnimation
voidStopAllAnimations
boolIsAnimationPlaying
boolDispatchActionThe built-in event-action vocabulary: "PlayAnim:Name", "PlayAnimReverse:Name", "StopAnim:Name".
boolDispatchVisualScriptAction
boolSetWidgetText
boolSetWidgetVisible
boolSetWidgetProgress
Miri::MVideoPlayer*FindVideoPlayerThe VideoPlayer node under a name (empty screen path searches every screen), or null when the name is not a video — MUIStatics' seam.
voidSetVisualScriptBindingText
voidSetVisualScriptBindingNumber
FBindingStatsGetBindingStats
boolInVisualScriptBindingEval
uint32_tVisualScriptEvalsLastTick
voidNotifyAssetChangedMarks a loaded asset stale so the next Tick evicts and rebuilds every screen using it — the entry point the file watcher drives, public so hosts without a watcher (and tests) can force the same reload.
Miri::TSharedPtr<Miri::MWidget>GetOverlayWidget
voidTick
boolHandleDirectionalDirectional navigation: spatial pick of the nearest focusable widget in the pressed direction (center-line projection with axis bias, the UE approach).
voidSetRightToLeftThe reading order screens build with when a node says "inherit" — set from the active culture.
boolIsRightToLeft
boolHandleAcceptAccept delivered as a real activate on the focused widget (the widget translates it internally — click delegate, toggle, open); no synthesized mouse events.
boolHandleBackBack/cancel: a host- or screen-defined handler first, then pop of the top code-driven screen.
FMiriGraphicsInputRouter&GetInputRouterThe one router every host feeds.
const FMiriGraphicsInputRouter&GetInputRouter
voidFeedGamepadButton
voidFeedGamepadAxis
voidFeedKeyHost keyboard events (the host's own key code).
voidSetInputActionSystemThe input action system whose UI.* actions drive the router each tick; null (default) uses the global one, a split-screen player passes its own.
FMiriGraphicsInputConfigGetDesiredInputConfig
int32_tGetInputOwnerHandle
boolHasInputOwner
voidSetPointerSink
voidInstallBridgePointerSink
voidSetAnalogCursorBounds
boolIsAnalogCursorActive
Miri::MiriVec2GetAnalogCursorPosition
InputActionSystem&GetActionSystem
boolProjectFileExists
boolActivateActionButton
uint32_tGetScreenBuildCount
size_tGetPooledScreenCount
uint32_tGetGlyphResolveCount
voidSetBackHandler
voidNotifyInputDeviceHosts report the device each input event came from; switching to the gamepad re-applies the focus visual, switching to the mouse clears it.
EMiriGraphicsInputDeviceGetActiveInputDevice
Miri::TSharedPtr<Miri::MWidget>FindNamed
size_tGetLeavingScreenCount
std::vector<FMiriGraphicsScreenInfo>DescribeScreensRead-only views for the editor's UI inspector and tests.
std::vector<FMiriGraphicsFocusableInfo>PreviewNavigation
int32_tGetFocusIndex
int32_tMountedCount

Function details

CMiriGraphicsScreenStack

C++
CMiriGraphicsScreenStack()

~CMiriGraphicsScreenStack

C++
~CMiriGraphicsScreenStack()

CMiriGraphicsScreenStack

C++
CMiriGraphicsScreenStack(const CMiriGraphicsScreenStack&) = delete

operator=

C++
CMiriGraphicsScreenStack& operator=(const CMiriGraphicsScreenStack&) = delete

SetPathResolver

C++
void SetPathResolver(std::function<std::string(const std::string&)> resolver)

Resolves a serialized asset path ("Assets/UI/x.ui") to something LoadFromFile can open. Identity when unset.

SetFocusSink

C++
void SetFocusSink(std::function<void(Miri::TSharedPtr<Miri::MWidget>)> sink)

Where directional nav sends the newly focused widget (host wires this to its Miri input processor's SetFocus). Optional.

SetBindingResolver

C++
void SetBindingResolver(FMiriGraphicsBindingResolver resolver)

Supplies the current value for a widget data-binding source. Applied to bound widgets at instantiation, then re-resolved every Tick with a dirty-check so bound widgets track live gameplay state. Optional — without it authored defaults stand. Set it before the first SyncFromWorld.

SetEventSink

C++
void SetEventSink(FMiriGraphicsEventSink sink)

Receives (widgetName, eventName, action) for every authored widget event that fires. Optional; without it events are dropped.

InstallVfsPathResolver

C++
void InstallVfsPathResolver()

Convenience installers so every host mounts identically. The VFS path resolver maps "Assets/UI/x.ui" to a native path; the bridge focus sink drives CMiriMowoBridge's input processor; the world binding resolver wires FMiriGraphicsBindingLibrary reflection paths against the host's live World + entity-name lookup (customHook is the Visual Script seam).

InstallBridgeFocusSink

C++
void InstallBridgeFocusSink()

InstallWorldBindingResolver

C++
void InstallWorldBindingResolver(FMiriGraphicsBindingLibrary::FWorldProvider world, FMiriGraphicsBindingLibrary::FEntityLookup lookup, FMiriGraphicsBindingLibrary::FCustomSourceHook customHook = FMiriGraphicsBindingLibrary::FCustomSourceHook())

EnableHotReload

C++
void EnableHotReload(bool enable)

Watches every loaded .ui file and rebuilds its screens on save. Watch callbacks only record intent; the rebuild happens in Tick.

LoadLocalization

C++
static uint32_t LoadLocalization(const std::string& rootDir, const std::string& locale)

Loads <rootDir>/<locale>/*.txt string tables (key=value lines, file stem = namespace) into Miri's CTextLocalizationManager and makes the locale current, so authored text_key props resolve through CText::FromKey. Returns the number of entries registered.

SetProjectTheme

C++
bool SetProjectTheme(const std::string& themePath)

Theme every screen without its own theme: resolves colour tokens against. Loaded through the path resolver and cached; empty clears back to the built-in default theme.

GetActiveTheme

C++
const FMiriGraphicsTheme& GetActiveTheme() const

SetSafeZoneInsets

C++
void SetSafeZoneInsets(float fractionX, float fractionY)

Title-safe insets as a fraction of each axis, applied by every screen's root canvas (the designer's Safe Area overlay draws the same box).

SetSafeInsets

C++
void SetSafeInsets(const FMiriGraphicsSafeInsets& insets)

Per-side insets for THIS stack only (one split-screen viewport, one PIE window). Without it screens use the process default the symmetric call sets.

ClearSafeInsets

C++
void ClearSafeInsets()

SyncFromWorld

C++
void SyncFromWorld(World& world)

SyncWorldWidgets

C++
void SyncWorldWidgets(World& world, const FMiriGraphicsViewInfo& view)

Places every visible UIWorldWidgetComponent's tree at its entity's projected screen position. Call once per frame after the camera is resolved; an invalid view hides the layer instead of dropping the trees. This is the screen-space fallback — components with worldSpace = false use it exclusively, and everything falls back to it when the offscreen renderer is unavailable.

SyncWorldWidgets3D

C++
void SyncWorldWidgets3D(World& world, const FMiriGraphicsViewInfo& view, const FWorldQuadSink& sink)

MarkWorldWidgetDirty

C++
void MarkWorldWidgetDirty(uint64_t owner)

Marks a world widget's offscreen texture stale so the next SyncWorldWidgets3D re-renders it. Bound widgets whose data changed call this automatically; hosts can force a refresh (e.g. a health bar tick).

RecordPendingWorldWidgets

C++
void RecordPendingWorldWidgets()

HitTestWorldWidgets

C++
FMiriGraphicsWorldHit HitTestWorldWidgets(const Vec3& rayOrigin, const Vec3& rayDir) const

Ray-vs-quad hit test against the interactive world-widget quads resolved by the last SyncWorldWidgets3D, nearest hit first. On a hit, the local UV is filled in (top-left origin, matching the widget's own coordinates).

RouteWorldWidgetClick

C++
bool RouteWorldWidgetClick(const Vec3& rayOrigin, const Vec3& rayDir)

Ray-picks the nearest interactive world widget and dispatches a synthetic left click (button down + up) to the widget under the mapped local point, exactly as if the user had clicked that pixel of the offscreen tree. Returns true when a widget consumed it.

Clear

C++
void Clear()

PushScreen

C++
int32_t PushScreen(const std::string& assetPath, int32_t zOrder = 1000, bool modal = false)

Code-driven screens (pause menu, main menu, loading). Returns a handle for PopScreen; 0 on load failure. Modal screens contain gamepad focus and report through HasModalScreen so the host can gate game input.

PopScreen

C++
bool PopScreen(int32_t handle)

PopTopScreen

C++
bool PopTopScreen()

PushScreenOnLayer

C++
int32_t PushScreenOnLayer(const std::string& assetPath, const std::string& layer)

Layer-addressed push: the layer picks the z band and whether the screen is modal ("game", "menu", "modal", "toast" — see FMiriGraphicsScreenLayers). Opening a screen remembers the focused widget and popping it gives focus back.

PopLayer

C++
int32_t PopLayer(const std::string& layer)

CountOnLayer

C++
int32_t CountOnLayer(const std::string& layer) const

IsScreenMounted

C++
bool IsScreenMounted(int32_t handle) const

GetScreenPath

C++
std::string GetScreenPath(int32_t handle) const

SetScreenBackHandler

C++
void SetScreenBackHandler(int32_t handle, std::function<bool()> handler)

Back for one screen instance; runs before the global handler when that screen is the top code-driven one.

AttachViewModel

C++
bool AttachViewModel(int32_t handle, std::shared_ptr<FMiriGraphicsViewModel> model)

The per-instance state of a pushed screen: "self.<field>" bindings read it, so two copies of one asset hold separate values. Returns false for a dead handle.

GetViewModel

C++
std::shared_ptr<FMiriGraphicsViewModel> GetViewModel(int32_t handle) const

PushScreenWithViewModel

C++
int32_t PushScreenWithViewModel(const std::string& assetPath, const std::string& layer, std::shared_ptr<FMiriGraphicsViewModel> model)

SetWidgetTextOnScreen

C++
bool SetWidgetTextOnScreen(int32_t handle, const std::string& widgetName, const std::string& text)

Handle-addressed twins of the path-addressed setters above: they reach the instance, not the first screen that happens to share the asset.

FindNamedOnScreen

C++
Miri::TSharedPtr<Miri::MWidget> FindNamedOnScreen(int32_t handle, const std::string& widgetName) const

SetWidgetVisibleOnScreen

C++
bool SetWidgetVisibleOnScreen(int32_t handle, const std::string& widgetName, bool visible)

SetWidgetProgressOnScreen

C++
bool SetWidgetProgressOnScreen(int32_t handle, const std::string& widgetName, float percent)

HasModalScreen

C++
bool HasModalScreen() const

PushedCount

C++
int32_t PushedCount() const

PlayAnimation

C++
bool PlayAnimation(const std::string& assetPath, const std::string& name)

Timeline playback on a mounted screen (world-scanned or pushed), addressed by its asset path. The two-argument form starts with the authored loop flag; the params form overrides loop/reverse and takes a completion callback (fired once, after the end pose is applied; looping runs never finish). Playing an already-running animation restarts it. Every finished run also reports through the event sink as (assetPath, "anim_finished", animationName).

PlayAnimation

C++
bool PlayAnimation(const std::string& assetPath, const std::string& name, const FMiriGraphicsAnimPlayParams& params)

StopAnimation

C++
bool StopAnimation(const std::string& assetPath, const std::string& name)

StopAllAnimations

C++
void StopAllAnimations(const std::string& assetPath)

IsAnimationPlaying

C++
bool IsAnimationPlaying(const std::string& assetPath, const std::string& name) const

DispatchAction

C++
bool DispatchAction(const std::string& assetPath, const std::string& action)

The built-in event-action vocabulary: "PlayAnim:Name", "PlayAnimReverse:Name", "StopAnim:Name". Authored widget events run through this before reaching the host's event sink; hosts and tests can dispatch the same verbs directly. Returns true when the action was one of the built-ins (whether or not the animation existed).

DispatchVisualScriptAction

C++
bool DispatchVisualScriptAction(const std::string& assetPath, const std::string& widgetName, const std::string& action)

SetWidgetText

C++
bool SetWidgetText(const std::string& assetPath, const std::string& widgetName, const std::string& text)

SetWidgetVisible

C++
bool SetWidgetVisible(const std::string& assetPath, const std::string& widgetName, bool visible)

SetWidgetProgress

C++
bool SetWidgetProgress(const std::string& assetPath, const std::string& widgetName, float percent)

FindVideoPlayer

C++
Miri::MVideoPlayer* FindVideoPlayer(const std::string& assetPath, const std::string& widgetName) const

The VideoPlayer node under a name (empty screen path searches every screen), or null when the name is not a video — MUIStatics' seam.

SetVisualScriptBindingText

C++
void SetVisualScriptBindingText(const std::string& name, const std::string& text)

SetVisualScriptBindingNumber

C++
void SetVisualScriptBindingNumber(const std::string& name, double number)

GetBindingStats

C++
FBindingStats GetBindingStats() const

InVisualScriptBindingEval

C++
bool InVisualScriptBindingEval() const

VisualScriptEvalsLastTick

C++
uint32_t VisualScriptEvalsLastTick() const

NotifyAssetChanged

C++
void NotifyAssetChanged(const std::string& assetPath)

Marks a loaded asset stale so the next Tick evicts and rebuilds every screen using it — the entry point the file watcher drives, public so hosts without a watcher (and tests) can force the same reload.

GetOverlayWidget

C++
Miri::TSharedPtr<Miri::MWidget> GetOverlayWidget() const

Tick

C++
void Tick(float deltaSeconds)

HandleDirectional

C++
bool HandleDirectional(int32_t dx, int32_t dy)

Directional navigation: spatial pick of the nearest focusable widget in the pressed direction (center-line projection with axis bias, the UE approach). Falls back to the linear cycle only when the tree has no usable geometry (headless). Focusability comes from the MWidget IsFocusable predicate, not a type whitelist. The focused widget's navigation rules (nav_up / nav_down / nav_left / nav_right on its node or an ancestor) can stop the move, wrap it at the edge, or send it to a named widget instead.

SetRightToLeft

C++
void SetRightToLeft(bool rightToLeft)

The reading order screens build with when a node says "inherit" — set from the active culture. Takes effect on the next (re)build; call before pushing, or push again after switching.

IsRightToLeft

C++
bool IsRightToLeft() const

HandleAccept

C++
bool HandleAccept()

Accept delivered as a real activate on the focused widget (the widget translates it internally — click delegate, toggle, open); no synthesized mouse events.

HandleBack

C++
bool HandleBack()

Back/cancel: a host- or screen-defined handler first, then pop of the top code-driven screen.

GetInputRouter

C++
FMiriGraphicsInputRouter& GetInputRouter()

The one router every host feeds. SDL numbers are translated inside; the stick is normalised here so hosts pass the raw axis value.

GetInputRouter

C++
const FMiriGraphicsInputRouter& GetInputRouter() const

FeedGamepadButton

C++
void FeedGamepadButton(uint8_t sdlButton, bool down)

FeedGamepadAxis

C++
void FeedGamepadAxis(uint8_t sdlAxis, int16_t value)

FeedKey

C++
void FeedKey(int32_t keyCode, bool down)

Host keyboard events (the host's own key code). Keys are only acted on when bound with GetInputRouter().BindKey, so Miri's own keyboard handling is not doubled.

SetInputActionSystem

C++
void SetInputActionSystem(InputActionSystem* actions, bool enabled = true)

The input action system whose UI.* actions drive the router each tick; null (default) uses the global one, a split-screen player passes its own.

GetDesiredInputConfig

C++
FMiriGraphicsInputConfig GetDesiredInputConfig() const

GetInputOwnerHandle

C++
int32_t GetInputOwnerHandle() const

HasInputOwner

C++
bool HasInputOwner() const

SetPointerSink

C++
void SetPointerSink(FPointerSink sink)

InstallBridgePointerSink

C++
void InstallBridgePointerSink()

SetAnalogCursorBounds

C++
void SetAnalogCursorBounds(float width, float height)

IsAnalogCursorActive

C++
bool IsAnalogCursorActive() const

GetAnalogCursorPosition

C++
Miri::MiriVec2 GetAnalogCursorPosition() const

GetActionSystem

C++
InputActionSystem& GetActionSystem() const

ProjectFileExists

C++
bool ProjectFileExists(const std::string& path) const

ActivateActionButton

C++
bool ActivateActionButton(EMiriGraphicsAction action)

GetScreenBuildCount

C++
uint32_t GetScreenBuildCount() const

GetPooledScreenCount

C++
size_t GetPooledScreenCount() const

GetGlyphResolveCount

C++
uint32_t GetGlyphResolveCount() const

SetBackHandler

C++
void SetBackHandler(FBackHandler handler)

NotifyInputDevice

C++
void NotifyInputDevice(EMiriGraphicsInputDevice device)

Hosts report the device each input event came from; switching to the gamepad re-applies the focus visual, switching to the mouse clears it.

GetActiveInputDevice

C++
EMiriGraphicsInputDevice GetActiveInputDevice() const

FindNamed

C++
Miri::TSharedPtr<Miri::MWidget> FindNamed(const std::string& name) const

GetLeavingScreenCount

C++
size_t GetLeavingScreenCount() const

DescribeScreens

C++
std::vector<FMiriGraphicsScreenInfo> DescribeScreens() const

Read-only views for the editor's UI inspector and tests.

PreviewNavigation

C++
std::vector<FMiriGraphicsFocusableInfo> PreviewNavigation() const

GetFocusIndex

C++
int32_t GetFocusIndex() const

MountedCount

C++
int32_t MountedCount() const
Generated from MiriGraphics/CMiriGraphicsScreenStack.h via mirigraphics.json · Dec 5, 2026Version 1.1.0