public sealed class UiApplicationAn application whose whole content is a user interface: a window, a device, and the four steps of a frame.
Remarks
The four steps are worth naming, because they are the whole loop: pump the platform's events into the document, run the layout and draw passes, turn the draw list into geometry, and record that geometry into a frame. Only the last of the four knows what a GPU is — which is why Frames means something on a machine with no Vulkan at all.
⚠ This existed three times before it existed once. Samples/02-HelloUi, Tools/Vixen.Templates' AppHost and Vixen.Editor.Host's EditorHost each carried it, and the copies had already diverged in ways nothing failed on: the sample never called Compose, so every translucent subtree in it drew at full strength; two of the three could not open a second window; and one of the three cached its tessellation while the others rebuilt every path in the draw list sixty times a second for a window where nothing had moved. What is here is the union of the correct halves.
⚠ No Vixen.Engine and no Vixen.App, and the absence is the reason this assembly exists. That host owns a frame loop built around an ECS world and a fixed-step accumulator; an interface's loop redraws a document. An application that wanted a window used to choose between writing this file and dragging a scene graph behind it.
⚠ It draws every frame rather than when something changes. Redrawing only on input is the right end state for a desktop application and it is not free: every animation, every timer and every background task's progress has to say that it moved, and one that forgets leaves a progress bar frozen at forty per cent. Said out loud here rather than left to be discovered on a laptop battery. The tessellation is skipped for a window whose drawing did not change — see Tessellate — which is most of the cost of a still frame.
Fields and properties (8)
public const string ContentClassThe class the mounted content's host element carries.
public Component? ContentThe component the interface was built from, once it has been.
public UiDocument DocumentThe document the loop lays out, draws and dispatches into.
public DiagnosticsPanel? DiagnosticsA debug panel this loop refreshes at the right moment, if the application made one.
public IWindow WindowThe window the application was opened on.
public IPlatform PlatformEverything the operating system does for this application.
public int FrameCountHow many frames have been drawn.
public BackgroundTaskManager TasksThe long operations this application is running, and what they have got to.
Events (3)
public Action<UiApplication>? StartedRaised once, after the interface is built and before the first frame is pumped.
public Action<UiApplication, UiFrame>? FrameRaised once a frame, after the events are pumped and before the document is updated.
public Action<UiApplication>? StoppingRaised once, after the loop stops and while the document is still alive.
Methods (5)
public static int Run(UiApplicationOptions options)Opens a window, runs the interface in it, and returns a process exit code.
public static int Run(UiApplicationOptions options, params ReadOnlySpan<string> arguments)The same, having first read the arguments every Vixen application understands.
public void Stop()Asks the loop to stop at the end of this frame.
public bool Quit(UiCloseReason reason = Quit)Asks whether the application may close, and stops the loop if nothing refuses.
public void Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Used by (11)
- ProgramHelloUi
- ColorSchemeWiringTestsVixen.Ui.Desktop.Tests
- DesktopHotReloadVixen.Ui.Desktop.HotReload
- HotReloadSeamTestsVixen.Ui.Desktop.Tests
- PipelineCachePathTestsVixen.Ui.Desktop.Tests
- PlatformReachTestsVixen.Ui.Desktop.Tests
- QuitRequestTestsVixen.Ui.Desktop.Tests
- TextInputWiringTestsVixen.Ui.Desktop.Tests
- UiApplicationOptionsVixen.Ui.Desktop
- UiApplicationTestsVixen.Ui.Desktop.Tests
- UiDevelopmentVixen.Ui.Desktop