This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.EngineWindow Class

The class to create and manage engine windows: their components, relations with other windows, size, position, and other features.

To create the engine window, use one of the class constructors. For example:

Source code (C#)
// create an engine window of the specified size with the specified name
EngineWindow window = new EngineWindow("Window", 580, 300);
Then you can specify the window appearance (for example, set a title, an icon, change opacity, add borders, and so on), and properties (whether the window is the main one, or whether it can be nested), specify the engine tools (console, profiler, visualizer, etc.) available for the engine window, add widgets to the client area of the window.
Source code (C#)
// set an icon and a title for the window 
window.SetIcon(icon);
window.Title = "Vertical Group";

// set the window as the main one
window.Main = true;

// enable the console, profiler and visualizer for the window
window.ConsoleUsage = true;
window.ProfilerUsage = true;
window.VisualizerUsage = true;

// add widgets to the client area of the engine window
window.AddChild(new WidgetLabel(window.SelfGui,  String.Format("This is {0} window.", name)));
window.AddChild(new WidgetButton(window.SelfGui, name), Gui.ALIGN_CENTER);
The created window can remain a separate one, or it can be grouped with the other window(s). The group type is defined by using one of the GROUP_TYPE.*variables.
Source code (C#)
// separate windows
EngineWindow settings = new EngineWindow("Settings", 512, 256);
EngineWindow parameters = new EngineWindow("Parameters", 512, 256);

// grouped windows
EngineWindow settings_and_parameters = WindowManager.StackWindows(settings, parameters, EngineWindow.GROUP_TYPE.TAB);
The EngineWindow class also provides functions specifying the window group appearance (for example, separators position and size, tabs size, etc.).

To render the engine window, use the Show() function.

Notice
For more information on working with window groups, check the article on WindowManager class.

EngineWindow Class

Enums

HITTEST#

NameDescription
INVALID = -1
NORMAL = 0Client area of the window.
DRAGGABLE = 1Area of the window, by clicking onto which the window can be moved.
RESIZE_TOPLEFT = 2Area of the window that can be dragged to resize the window to the top and/or left direction.
RESIZE_TOP = 3Area of the window that can be dragged to resize the window to the top direction.
RESIZE_TOPRIGHT = 4Area of the window that can be dragged to resize the window to the top and/or right direction.
RESIZE_RIGHT = 5Area of the window that can be dragged to resize the window to the right direction.
RESIZE_BOTTOMRIGHT = 6Area of the window that can be dragged to resize the window to the bottom and/or right direction.
RESIZE_BOTTOM = 7Area of the window that can be dragged to resize the window to the bottom direction.
RESIZE_BOTTOMLEFT = 8Area of the window that can be dragged to resize the window to the bottom and/or left direction.
RESIZE_LEFT = 9Area of the window that can be dragged to resize the window to the left direction.

STATE#

NameDescription
SEPARATE_WINDOW = 0Separate system window.
SEPARATE_GROUP = 1Separate system window group.
NESTED_WINDOW = 2Nested window, a part of a window group.
NESTED_GROUP = 3Nested group of windows, a part of a window group.

GROUP_TYPE#

NameDescription
NONE = 0A separate window inside the group.
TAB = 1Windows are arranged into a group of tabs with a selected window displayed atop the others in the group.
HORIZONTAL = 2Windows are arranged into a horizontally displayed group.
VERTICAL = 3Windows are arranged into a vertically displayed group.

CALLBACK_INDEX#

NameDescription
WINDOW_EVENT = 0Callback on the window event.
FUNC_UPDATE = 1Callback after the window update.
FUNC_BEGIN_RENDER = 2Callback after the window rendering has begun.
FUNC_RENDER = 3Callback after the window rendering function.
FUNC_BEGIN_RENDER_GUI = 4Callback after the GUI rendering has begun.
FUNC_END_RENDER_GUI = 5Callback after the GUI rendering has ended.
FUNC_END_RENDER = 6Callback after the window rendering has ended.
FUNC_SWAP = 7Callback before calling the window swap.
NUM_CALLBACKS = 8Callback counter.

FLAGS#

NameDescription
MAIN = 1 << 0Main window.
CONSOLE_USAGE = 1 << 1Usage of the console for the window is enabled.
PROFILER_USAGE = 1 << 2Usage of the profiler for the window is enabled.
VISUALIZER_USAGE = 1 << 3Usage of the visualizer for the window is enabled.
SHOWN = 1 << 4Window is rendered.
FIXED_SIZE = 1 << 5Window size is fixed.
HOLD_ENGINE = 1 << 6Engine can't stop operating while this window is open.

Properties

bool Main#

The value indicating if the window is the main window.

Camera Camera#

The camera the image from which is rendered to the engine window.

Gui Gui#

The Gui instance.

int DisplayIndex#

The number of the display, on which the window is currently displayed.

bool IsSeparateWindow#

The value indicating if the window is a separate window.

bool IsSeparateGroup#

The value indicating if the window group is an independent group of windows located on the desktop.

bool IsNestedWindow#

The value indicating if the window is a nested window.

bool IsNestedGroup#

The value indicating if the window group is nested to another window group.

bool IsWindow#

The value indicating if this is a separate or a nested window.

bool IsGroup#

The value indicating if this is a separate or a nested group of windows.

bool IsNested#

The value indicating if this is a nested window or group of windows.

bool IsSeparate#

The value indicating if this is a separate window or group of windows.

EngineWindow.STATE State#

The window state.

EngineWindow.GROUP_TYPE GroupType#

The window group type.

Gui SelfGui#

The Gui instance.

ivec2 Position#

The engine window screen position — coordinates of the left top corner.

ivec2 ClientPosition#

The screen position of the window content area — coordinates of the left top corner.

ivec2 ClientLocalPosition#

The screen position of the window content area — coordinates of the left top corner, in coordinates of the current window GUI.

ivec2 Size#

The engine window size.

ivec2 ClientSize#

The size of the window client area.

ivec2 MinSize#

The minimum possible size of the window.

ivec2 MaxSize#

The maximum possible size of the window.

string Title#

The title for the engine window.

float Opacity#

The opacity for the engine window.

bool BordersEnabled#

The value indicating if the borders are enabled for the engine window.

int BorderSize#

The engine window border size.

bool ConsoleUsage#

The value indicating if usage of the console is enabled for the engine window.

bool ProfilerUsage#

The value indicating if usage of the profiler is enabled for the engine window.

bool VisualizerUsage#

The value indicating if usage of the visualizer is enabled for the engine window.

bool Resizable#

The value indicating if the engine window is resizable by the mouse.

int ResizeBorderSize#

The size of the border that is manipulated to resize the window, in pixels.

bool IsFullscreen#

The value indicating if the engine window is the fullscreen state.

bool IsShown#

The value indicating if the engine window is rendered.

bool IsHidden#

The value indicating if the engine window isn't rendered.

bool IsFocused#

The value indicating if the engine window is in focus.

bool IsMinimized#

The value indicating if the engine window is minimized.

bool IsMaximized#

The value indicating if the engine window is maximized.

int Order#

The order of the window.

bool GroupUsage#

The value indicating if usage of the engine window as a group is enabled.

bool NestedUsage#

The value indicating if usage of the engine window as a nested window is enabled.

int NumNestedWindows#

The total number of nested windows in the group.

EngineWindow ParentGroup#

The group into which the current window is nested, or NULL if it's a separate window.

EngineWindow GlobalParentGroup#

The top group of the hierarchy into which the current window is nested, or NULL if it's a separate window.

int CurrentTab#

The index of the currently active tab.

int NumDroppedItems#

The number of dropped files and/or folders.

int NumModalWindows#

The total number of modal windows.

EngineWindow ModalParent#

The modal parent of the window.

bool IsModalParent#

The value indicating if the window is parent for any modal window.

bool IsModal#

The value indicating if the window is modal.

bool IgnoreSystemClose#

The value indicating if closing the window using the OS methods is ignored.

bool HoldEngine#

The value indicating if the engine operation can't be stopped while this window is open.

string VideoModeName#

The window size and name of the current video mode: fullscreen or windowed.

ulong ID#

The ID of the engine window, if the window is external.

bool AlwaysOnTop#

The true if the window is always on top; otherwise, false.

bool SkipRenderEngine#

The true if the Engine rendering is disabled; otherwise, false.

Members


EngineWindow ( string title, int width, int height, int flags = 0 ) #

Constructor. Creates the engine window of the specified size with the specified name using the specified flags.

Arguments

  • string title - The title of the window, in UTF-8 encoding.
  • int width - Window width.
  • int height - Window height.
  • int flags - Mask containing window flags.

EngineWindow ( int width, int height, int flags = 0 ) #

Constructor. Creates the engine window of the specified size using the specified flags.

Arguments

  • int width - Window width.
  • int height - Window height.
  • int flags - Mask containing window flags.

EngineWindow ( ivec2 size, int flags = 0 ) #

Constructor. Creates the engine window of the specified size using the specified flags.

Arguments

  • ivec2 size - Window size.
  • int flags - Mask containing window flags.

void MoveToCenter ( ) #

Moves the engine window to the center of the current screen.

bool SetIcon ( Image icon ) #

Sets the icon for the engine window.

Arguments

  • Image icon - The icon for the engine window.

Return value

true if the specified icon is successfully set for the engine window, otherwise false.

Image GetIcon ( ) #

Returns the icon for the engine window.

Return value

The icon for the engine window.

void Show ( ) #

Enables rendering of the engine window.

void Hide ( ) #

Disables rendering of the engine window.

void SetFocus ( ) #

Sets the focus to the engine window.

void Minimize ( ) #

Minimizes the engine window to an iconic representation.

void Maximize ( ) #

Makes the engine window as large as possible.

void Restore ( ) #

Restores the size and position of the minimized or maximized engine window.

void SetMouseGrab ( bool value ) #

Sets a value indicating if the mouse pointer is bound to the engine window.

Arguments

  • bool value - true if the pointer cannot leave the engine window, otherwise false.

EngineWindow.HITTEST GetHitTestResult ( ) #

Returns a value indicating in which area of the engine window the mouse is located.

Return value

Value indicating the window area, one of the HITTEST.* values.

void ToTop ( ) #

Makes the window appear on top of all other windows.

void AddChild ( Widget widget, int flags = -1 ) #

Adds the specified widget as a child to the client area of the engine window.

Arguments

  • Widget widget - Child widget to be added.
  • int flags - Widget flags: one of the ALIGN_* pre-defined variables. This is an optional parameter.

void RemoveChild ( Widget widget ) #

Removes the specified widget from the engine window.

Arguments

  • Widget widget - Child widget to be removed.

Widget GetChild ( int index ) #

Returns the child widget by its index.

Arguments

  • int index - Widget index.

Return value

Child widget.

int GetNumChildren ( ) #

Returns the total number of children widgets of the engine window.

Return value

The total number of children widgets.

EngineWindow GetNestedWindow ( int index ) #

Returns the nested engine window by its index.

Arguments

  • int index - Index of the nested window.

Return value

Nested engine window.

int GetNestedWindowIndex ( EngineWindow window ) #

Returns the index of the specified nested engine window.

Arguments

  • EngineWindow window - Nested engine window.

Return value

Index of the nested window.

bool ContainsNestedWindow ( EngineWindow window ) #

Returns the value indicating if the specified window is a direct child of the current window.

Arguments

  • EngineWindow window - Window to be checked.

Return value

true if the specified window is a direct child of the current one, otherwise false.

bool ContainsNestedWindowGlobal ( EngineWindow window ) #

Returns the value indicating if the specified window is a child of the current window or any of its children.

Arguments

  • EngineWindow window - Window to be checked.

Return value

true if the specified window is a child of the current one, otherwise false.

bool IsGlobalChildOf ( EngineWindow window ) #

Returns the value specifying if the current window is a part of a hierarchy of the specified window.

Arguments

  • EngineWindow window - Window to be checked.

Return value

true if the current window is globally a child of the specified one, otherwise false.

int GetTabWidth ( int index ) #

Returns the width of the tab.

Arguments

  • int index - The index of the tab.

Return value

The width of the the tab.

int GetTabHeight ( int index ) #

Returns the height of the tab.

Arguments

  • int index - The index of the tab.

Return value

The height of the tab.

int GetTabBarWidth ( int index ) #

Returns the width of the tab bar.

Arguments

  • int index - The index of the tab.

Return value

The width of the tab bar.

int GetTabBarHeight ( int index ) #

Returns the height of the tab bar.

Arguments

  • int index - The index of the tab.

Return value

The height of the tab bar.

ivec2 GetTabLocalPosition ( int index ) #

Returns the screen position of the tab relatively to the parent group (global window). The coordinates represent the displacement from the top left corner of the parent group (global window).

Arguments

  • int index - The index of the tab.

Return value

The screen position of the tab relatively to the parent group (global window).

ivec2 GetTabBarLocalPosition ( int index ) #

Returns the screen position of the tab bar relatively to the parent group (global window). The coordinates represent the displacement from the top left corner of the parent group (global window).

Arguments

  • int index - The index of the tab.

Return value

The screen position of the tab bar relatively to the parent group (global window).

void SetHorizontalTabWidth ( int index, int width ) #

Sets the width of the tab in the group of tabs arranged horizontally.

Arguments

  • int index - The index of the tab.
  • int width - The width of the tab in the group of tabs arranged horizontally.

void SetVerticalTabHeight ( int index, int height ) #

Sets the height of the tab in the group of tabs arranged vertically.

Arguments

  • int index - The index of the tab.
  • int height - The height of the tab in the group of tabs arranged vertically.

void SetSeparatorPosition ( int index, int pos ) #

Sets the position of the line separating a tab group from the rest of the area. The separator line can be horizontal or vertical depending on the group type.

Arguments

  • int index - Index of the tab.
  • int pos - Position of the separation line, in pixels, from the top-left corner of the window.

int GetSeparatorPosition ( int index ) #

Returns the position of the line separating a tab group from the rest of the area. The separator line can be horizontal or vertical depending on the group type.

Arguments

  • int index - Index of the tab.

Return value

Position of the separation line, in pixels, from the top-left corner of the window.

void SetSeparatorValue ( int index, float value ) #

Sets the size of the tab separator.

Arguments

  • int index - Index of the tab.
  • float value - Size of the tab separator.

float GetSeparatorValue ( int index ) #

Returns the size of the tab separator.

Arguments

  • int index - Index of the tab.

Return value

Size of the tab separator.

void SwapTabs ( int first, int second ) #

Swaps the specified tabs.

Arguments

  • int first - Index of the first tab.
  • int second - Index of the second tab.

bool IsHover ( ivec2 global_mouse_pos ) #

Returns the value indicating if the mouse is hovering over the window.

Arguments

  • ivec2 global_mouse_pos - Global screen coordinates of the mouse relative to the main display.

Return value

true if the mouse hovers over the current window, otherwise false.

bool IsClientHover ( ivec2 global_mouse_pos ) #

Returns the value indicating if the mouse is hovering over the client area of the window.

Arguments

  • ivec2 global_mouse_pos - Global screen coordinates of the mouse relative to the main display.

Return value

true if the mouse hovers over the client area of the window, otherwise false.

int GetHoverTabBar ( ivec2 global_mouse_pos, out ivec2 out_bar_pos, out ivec2 out_bar_size ) #

Returns the index of the tab over the bar of which the mouse hovers.

Arguments

  • ivec2 global_mouse_pos - Global screen coordinates of the mouse relative to the main display.
  • out ivec2 out_bar_pos - Position of the tab bar.
  • out ivec2 out_bar_size - Size of the tab bar.

Return value

Index of the tab.

int GetHoverTabBarArea ( ivec2 global_mouse_pos, out ivec2 out_area_pos, out ivec2 out_area_size ) #

Returns the index of the tab over the bar area of which the mouse hovers.

Arguments

  • ivec2 global_mouse_pos - Global screen coordinates of the mouse relative to the main display.
  • out ivec2 out_area_pos
  • out ivec2 out_area_size

Return value

Index of the tab.

string GetDroppedItem ( int index ) #

Returns the absolute path to the file or folder dropped to the window.

Arguments

  • int index - Index of the dropped file or folder.

Return value

Absolute path to the dropped file or folder.

void Screenshot ( string path ) #

Creates a screenshot after the rendering stage is completed.

Arguments

  • string path - Path to save the screenshot.

void DisableFullscreen ( ) #

Disables the fullscreen mode for the window in the fullscreen mode and sets the focus to this window.

bool EnableFullscreen ( int display = -1, int mode = -1 ) #

Enables the specified fullscreen mode for the specified display.

Arguments

  • int display - Display index.
  • int mode - Index of the mode supported by the display.

Return value

true if the specified fullscreen mode has been enabled for the specified display; otherwise, false.

void SetModal ( EngineWindow parent_window ) #

Sets the current window modal to the specified parent window. Both the parent and the child windows must be separate.

Arguments

  • EngineWindow parent_window - Parent window.

void AddModalWindow ( EngineWindow window ) #

Adds the argument window as modal to the current window. Both the parent and the child windows must be separate.

Arguments

  • EngineWindow window - Window to be added as modal.

void RemoveModalWindow ( EngineWindow window ) #

Removes the argument modal window from this window.

Arguments

  • EngineWindow window - Engine window.

EngineWindow GetModalWindow ( int index ) #

Returns the modal window for this window by its index.

Arguments

  • int index - Index of the modal window.

Return value

Modal window.

bool IsChild ( Widget widget ) #

Checks if the argument widget is the child of the current window.

Arguments

Return value

true if the widget is the child of the current window; otherwise, false.

void Unstack ( ) #

Removes the current window from a parent group. If there is only one window left, the group is automatically deleted after removing the window from it.

void Arrange ( ) #

Rearranges the widgets of the window to lay them out neatly. The function forces to recalculate sizes of window widgets so that they fit the current layout. If this function is not called, widget modifications (adding a new widget or changing the size and/or position of the existing one) made in the current update() will be available only in the next frame (i.e. with one-frame lag). After rearranging, the expand() function should be called.

void Expand ( ) #

Adapts positions of window widgets to the current window size after rearranging widgets by using the arrange() function. If there is an additional space in the window that exceeds the minimum required space for widgets, the widgets will use it.

void SetSkipRenderEngine ( bool engine ) #

Disables the Engine rendering for the current window (even if it has the main camera flag or the user camera set). This doesn't disable the Gui instance, so widgets and the console remain available.

Arguments

  • bool engine - true to disable rendering, false to enable it.

bool IsSkipRenderEngine ( ) #

Returns the value indicating whether the Engine rendering is disabled or not.

Return value

true if the Engine rendering is disabled; otherwise, false.

void SetAlwaysOnTop ( bool top ) #

Sets the window to always be rendered above the other windows.

Arguments

  • bool top - true to render the window always on top; otherwise, false.

bool IsAlwaysOnTop ( ) #

Returns the value indicating if the window is always rendered above the other windows.

Return value

true if the window is always on top; otherwise, false.
Last update: 2022-12-14
Build: ()