The Major Overhaul of Pain, Suffering, Wayland and Fun
This merge request completely overhauls the user interface system in Toolbox, fixing many architectural issues with the engine itself, and adding support for some really cool usability features.
Multi-window UIs
The engine takes care of the annoying stuff such as shared graphics resources. You can now make games and applications that make use of multiple windows.
Each window in Toolbox becomes a Display
object. Each Display
has a list of Layer
objects, which are updated each frame while the display is active.
Widget rendering overhaul
In Socially Distant, the game provides its own rendering routines and shaders for the UI system. That capability has been removed in this merge request. Toolbox is now in full control of rendering the UI. This breaks Socially Distant widget effects, but this will be addressed in a later MR.
Menus
Each widget now has a ContextMenuWidget
property. This property lets you define another widget that should be used as a right-click context menu for the widget on which the property is set.
Building on this, a MenuBar
widget has been added, allowing the creation of application menu bars. File, edit, view, window, wayland, help.
Application lifecycle overhaul
The base Application
class has far more grannular lifecycle hooks that the client application can override with its own functionality. This allows for headless applications, applications with more than one window, and applications that can actually control themselves.
Synchronization and Threading
Asynchronous methods can now no longer continue to execute while a display is rendering. This is the same behaviour in Socially Distant.
Async continuations are now only allowed to execute for as much time as it took to render the previous frame, forcing the engine to distribute huge tasks with lots of continuations across many frames instead of running them all at once (like Socially Distant does), keeping the UI more responsive.
JobThread
has been added, allowing you to start a background thread that accepts work from other threads. The editor has one, it loads things.
Editor splash screen
The editor now has a basic splash screen that it shows while loading a project.
Multiple editor windows
It is now possible to create separate editor windows.
Widget layers
Widget layers are essentially Socially Distant's GuiService
as a Toolbox layer. If all you need is a window with UI on it, WidgetLayer
will get you that. It processes input events directly from the window and manages UI layout.
Editor performance fixes
The editor theme now caches theme properties correctly, preventing needless UI layout updates.