UI System

Menus and HUDs are built on the engine's own screen-space UI — not on ImGui (which is the editor's tooling only). UI entities live in the same scene/ECS and are clickable in the runtime through the UISystem. Author them in the editor's UI Designer and save them as .ui assets, or build them from code.

Building blocks

ComponentRole
UICanvasComponentRoot of a UI tree; defines the screen-space canvas.
UITransformComponentAnchored rect (position/size/anchor) for a UI element.
UIImageComponentSprite/panel, with optional 9-slice for scalable frames.
UITextComponentText label (bitmap font).
UIButtonComponentClickable button; fires a named action.
UISlider / UIToggle / UIDropdown / UIProgressBarStandard interactive widgets.
UILayoutGroupComponentAuto-arranges children (rows/columns).
UIScrollViewComponentClipped, scrollable content region.
HUDComponentMarks a canvas as an in-game HUD.

Named actions

A button authored in the editor runs game code through a named action. Register a handler in C++ and reference its name from the widget's ActionName:

Thread::UIActions::Bind("menu.start", [] {
    // load the first level, switch state machine to Playing, …
});

Widgets (button / slider / toggle / dropdown) carry a serializable ActionName, so a menu authored entirely in the editor can drive gameplay. Dispatch is deferred to the top of the next frame — handlers may rebuild the scene safely. The same mechanism backs TriggerComponent's OnEnter/OnExit actions.

World-space textured quads (icons, health bars in the 3D scene) use SpriteComponent instead — that is drawn with the scene camera, not the screen-space canvas.

System UI

Menu i HUD-y powstają na własnym UI silnika w przestrzeni ekranu — nie na ImGui (to wyłącznie narzędzia edytora). Encje UI żyją w tej samej scenie/ECS i w grze są klikalne przez UISystem. Tworzysz je w UI Designerze edytora i zapisujesz jako assety .ui albo budujesz z kodu.

Elementy

KomponentRola
UICanvasComponentKorzeń drzewa UI; określa canvas w przestrzeni ekranu.
UITransformComponentZakotwiczony prostokąt (pozycja/rozmiar/kotwica) elementu UI.
UIImageComponentSprite/panel, z opcjonalnym 9-slice dla skalowalnych ramek.
UITextComponentEtykieta tekstowa (czcionka bitmapowa).
UIButtonComponentKlikalny przycisk; wywołuje nazwaną akcję.
UISlider / UIToggle / UIDropdown / UIProgressBarStandardowe interaktywne widgety.
UILayoutGroupComponentAutomatycznie układa dzieci (wiersze/kolumny).
UIScrollViewComponentPrzycinany, przewijany obszar treści.
HUDComponentOznacza canvas jako HUD w grze.

Nazwane akcje

Przycisk zrobiony w edytorze uruchamia kod gry przez nazwaną akcję. Zarejestruj handler w C++ i wpisz jego nazwę w ActionName widgetu:

Thread::UIActions::Bind("menu.start", [] {
    // wczytaj pierwszy poziom, przełącz maszynę stanów na Playing, …
});

Widgety (przycisk / suwak / przełącznik / lista) mają zapisywane ActionName, więc menu zrobione w całości w edytorze może sterować rozgrywką. Wywołanie jest odroczone na początek następnej klatki — handlery mogą bezpiecznie przebudować scenę. Ten sam mechanizm obsługuje akcje OnEnter/OnExit TriggerComponent.

Teksturowane prostokąty w świecie (ikony, paski zdrowia w scenie 3D) używają SpriteComponent — ten rysuje się kamerą sceny, nie na canvasie ekranu.