Unigine::Widgets
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
Unigine::Widgets are user classes that allow to code user interface only once and use them for both internal GUI (in-app) and external one (rendered in separate windows):
- If the Unigine-based application is run without the Interface plugin, widgets will be created inside the window, in the same way as default GUI is usually rendered.
- If the Interface plugin is loaded on the application start-up (via extern_plugin console command), widgets will be automatically created in separate windows in addition to the main application window.
Available Widgets#
Unigine::Widgets act identical to UnigineScript widgets and support completely the same interface:
- Unigine::Widgets::Button — the same as WidgetButton
- Unigine::Widgets::Canvas — the same as WidgetCanvas
- Unigine::Widgets::CheckBox — the same as WidgetCheckBox
- Unigine::Widgets::ComboBox — the same as WidgetComboBox
- Unigine::Widgets::Dialog — the same as WidgetDialog
- Unigine::Widgets::DialogColor — the same as WidgetDialogColor
- Unigine::Widgets::DialogFile — the same as WidgetDialogFile
- Unigine::Widgets::DialogImage — the same as WidgetDialogImage
- Unigine::Widgets::DialogMessage — the same as WidgetDialogMessage
- Unigine::Widgets::EditLine — the same as WidgetEditLine
- Unigine::Widgets::EditText — the same as WidgetEditText
- Unigine::Widgets::GridBox — the same as WidgetGridBox
- Unigine::Widgets::GroupBox — the same as WidgetGroupBox
- Unigine::Widgets::HBox — the same as WidgetHBox
- Unigine::Widgets::HPaned — the same as WidgetHPaned
- Unigine::Widgets::Icon — the same as WidgetIcon
- Unigine::Widgets::Label — the same as WidgetLabel
- Unigine::Widgets::ListBox — the same as WidgetListBox
- Unigine::Widgets::ScrollBox — the same as WidgetScrollBox
- Unigine::Widgets::Slider — the same as WidgetSlider
- Unigine::Widgets::Spacer — the same as WidgetSpacer
- Unigine::Widgets::Sprite — the same as WidgetSprite
- Unigine::Widgets::TabBox — the same as WidgetTabBox
- Unigine::Widgets::TreeBox — the same as WidgetTreeBox
- Unigine::Widgets::VBox — the same as WidgetVBox
- Unigine::Widgets::VPaned — the same as WidgetVPaned
- Unigine::Widgets::Window — the same as WidgetWindow
Also, there are three additional widgets available:
- Unigine::Widgets::DockBox — a widget that can be dragged and docked inside a window.
- Unigine::Widgets::Graph — a widget to create flow graphs.
- Unigine::Widgets::MdiBox — a widget to create multiple windows inside other windows
How to Use Unigine::Widgets Widgets#
- Include the necessary headers for widgets you are going to create in your script:
#include <core/systems/widgets/widget.h> #include <core/systems/widgets/widget_window.h>
- Create a widget:
When the application is run, either internal WidgetWindow or external InterfaceWidgetWindow will be automatically created depending on whether the Interface plugin is used or not.
int init() { // You can declare the namespace for convenience using Unigine::Widgets; // Create Unigine::Widgets::Window Window window = new Window("Unigine::Widgets::Window"); // Add the widget to the rendered GUI addChild(window,ALIGN_OVERLAP | ALIGN_CENTER); return 1; }
Last update:
2021-12-13
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)