User Interfaces for Unigine::Widgets
You can use user interface files (*.ui) to describe how widgets are laid out. Such UI files are created manually in Unigine UI syntax. They are handled by using Unigine::Widgets::UserInterface class.
How to Load Unigine UI
To load a Unigine-native user interface file, take the following steps:
- Include the UserInterface header. All other Unigine::Widgets headers are already included in it.
#include <core/systems/widgets/widget_interface.h>
- Declare UserInterface and the root widgets from the UI file in the global scope.
#include <core/systems/widgets/widget_interface.h> Unigine::Widgets::UserInterface ui; Unigine::Widgets::Window window;
- Load the user interface file. You also need to add root widgets to the rendered GUI for them to become visible.
int init() { // You can declare the namespace for convenience using Unigine::Widgets; // Load UI file in Unigine syntax ui = new UserInterface("samples/systems/widgets/widgets_01.ui"); // Render the root widget addChild(window,ALIGN_OVERLAP | ALIGN_CENTER); return 1; } int shutdown() { // Delete UserInterface with all widgets loaded from it delete ui; return 1; }
Last update: 10.08.2018
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter