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.

EngineWindow Class

Warning
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.

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:

EngineWindow Class

Members


static 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.

static 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.

static 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 setMain ( int main ) #

Sets the window as the main window.
Notice
There may be several windows that are set as main, or no main windows at all.

Arguments

  • int main - 1 to set the window as the main window, otherwise 0.

int isMain ( ) #

Returns a value indicating if this window is the main window.

Return value

1 if the window is the main window, otherwise 0.

void setCamera ( Camera camera ) #

Sets the camera the image from which is rendered to the engine window. This value has a higher priority over the main camera flag.

Arguments

Camera getCamera ( ) #

Returns the camera the image from which is rendered to the engine window. This value has a higher priority over the main camera flag.

Return value

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

Gui getGui ( ) #

Returns the parent Gui for a nested engine window.

Return value

Gui instance.

Gui getSelfGui ( ) #

Returns Gui instance for a fully-featured system window. For a nested window, may return NULL.

Return value

Gui instance.

int getDisplayIndex ( ) #

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

Return value

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

int isSeparateWindow ( ) #

Returns a value indicating if this window is an independent system window.

Return value

1 if the window is a separate window, otherwise 0.

int isSeparateGroup ( ) #

Returns a value indicating if this window group is an independent group of windows located on the desktop.

Return value

1 if the window group is an independent group of windows, otherwise 0.

int isNestedWindow ( ) #

Returns a value indicating if this window is a part of a window group.

Return value

1 if the window is a nested window, otherwise 0.

int isNestedGroup ( ) #

Returns a value indicating if this window group is a part of a window group.

Return value

1 if the window group is nested to another window group, otherwise 0.

int isWindow ( ) #

Returns a value indicating if the object is a separate or a nested window.

Return value

1 for a separate or a nested window, otherwise 0.

int isGroup ( ) #

Returns a value indicating if the object is a separate or a nested group of windows.

Return value

1 for a separate or a nested group of windows, otherwise 0.

int isNested ( ) #

Returns a value indicating if the object is a nested window or group of windows.

Return value

1 for a nested window or group of windows, otherwise 0.

int isSeparate ( ) #

Returns a value indicating if the object is a separate window or group of windows.

Return value

1 for a separate window or group of windows, otherwise 0.

int getState ( ) #

Returns the window state: if it's a separate or nested window or group of windows.

Return value

The window state.

int getGroupType ( ) #

Returns the window group type — vertical, horizontal, tab arrangement of windows, or an independent window inside a group.

Return value

The window group type.

void setPosition ( ivec2 position ) #

Sets the position of the left top corner of the engine window in the screen coordinates. In case of several displays, the position is relative to the main display.

Arguments

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

ivec2 getPosition ( ) #

Returns the position of the left top corner of the engine window in the screen coordinates. In case of several displays, the position is relative to the main display.

Return value

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

ivec2 getClientPosition ( ) #

Sets the position of the left top corner of the window content area (without the top bar and border of the system window) in the screen coordinates. In case of several displays, the position is relative to the main display.

Return value

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

ivec2 getClientLocalPosition ( ) #

Returns the position of the left top corner of the window content area (without the top bar and border of the system window) in coordinates of the GUI used for rendering of this window.

Return value

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

void moveToCenter ( ) #

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

void setSize ( ivec2 size ) #

Sets the engine window size.

Arguments

  • ivec2 size - The engine window size.

ivec2 getSize ( ) #

Returns the engine window size.

Return value

The engine window size.

ivec2 getClientSize ( ) #

Returns the size of the window client (content) area.

Return value

The size of the window client area.

void setMinSize ( ivec2 size ) #

Sets the minimum possible window size when resizing the window.

Arguments

  • ivec2 size - The minimum possible size of the window.

ivec2 getMinSize ( ) #

Returns the minimum possible window size when resizing the window.

Return value

The minimum possible size of the window.

void setMaxSize ( ivec2 size ) #

Sets the maximum possible window size when resizing the window..

Arguments

  • ivec2 size - The maximum possible size of the window.

ivec2 getMaxSize ( ) #

Returns the maximum possible window size when resizing the window..

Return value

The maximum possible size of the window.

void setTitle ( string title ) #

Sets the text of the title for the engine window.

Arguments

  • string title - The title of the engine window.

string getTitle ( ) #

Returns the text of the title for the engine window.

Return value

The title for the engine window.

int setIcon ( Image icon ) #

Sets the icon for the engine window.

Arguments

  • Image icon - The icon for the engine window.

Return value

1 if the specified icon is successfully set for the engine window, otherwise 0.

Image getIcon ( ) #

Returns the icon for the engine window.

Return value

The icon for the engine window.

void setOpacity ( float opacity ) #

Sets the opacity for the engine window.

Arguments

  • float opacity - The opacity for the engine window.

float getOpacity ( ) #

Returns the current opacity for the engine window.

Return value

The opacity for the engine window.

void setBordersEnabled ( int enabled ) #

Enables and disables the borders for the engine window.

Arguments

  • int enabled - 1 to enable the borders for the engine window, otherwise 0.

int isBordersEnabled ( ) #

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

Return value

1 if the borders are enabled for the engine window, otherwise 0.

void setBorderSize ( int size ) #

Sets the engine window border size.

Arguments

  • int size - The engine window border size.

int getBorderSize ( ) #

Returns the engine window border size.

Return value

The engine window border size.

void setConsoleUsage ( int usage ) #

Enables and disables usage of the console for the engine window in focus.

Arguments

  • int usage - 1 to enable usage of the console for the engine window in focus, otherwise 0.

int isConsoleUsage ( ) #

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

Return value

1 if usage of the console is enabled for the engine window, otherwise 0.

void setProfilerUsage ( int usage ) #

Enables and disables usage of the profiler for the engine window.

Arguments

  • int usage - 1 to enable usage of the profiler for the engine window, otherwise 0.

int isProfilerUsage ( ) #

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

Return value

1 if usage of the profiler is enabled for the engine window, otherwise 0.

void setVisualizerUsage ( int usage ) #

Enables and disables usage of the visualizer for the engine window.

Arguments

  • int usage - 1 to enable usage of the visualizer for the engine window, otherwise 0.

int isVisualizerUsage ( ) #

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

Return value

1 if usage of the visualizer is enabled for the engine window, otherwise 0.

void setResizable ( int resizable ) #

Enables and disables the possibility to resize the engine window by the mouse.

Arguments

  • int resizable - 1 to make the engine window resizable by the mouse, otherwise 0.

int isResizable ( ) #

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

Return value

1 if the engine window is resizable by the mouse, otherwise 0.

void setResizeBorderSize ( int size ) #

Sets the size of the border that is manipulated to resize the window.

Arguments

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

int getResizeBorderSize ( ) #

Returns the size of the border that is manipulated to resize the window.

Return value

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

int isFullscreen ( ) #

Returns the value indicating if the window is in a fullscreen state.

Return value

1 if the engine window is the fullscreen state, 0 if it's in the window mode.

void show ( ) #

Enables rendering of the engine window.

int isShown ( ) #

Returns a value indicating if a widget is rendered.

Return value

1 if the engine window is rendered, otherwise 0.

void hide ( ) #

Disables rendering of the engine window.

int isHidden ( ) #

Returns a value indicating if a widget is hidden.

Return value

1 if the engine window isn't rendered, otherwise 0.

void setFocus ( ) #

Sets the focus to the engine window.

int isFocused ( ) #

Returns the value if the engine window is currently in focus.

Return value

1 if the engine window is in focus, otherwise 0.

void minimize ( ) #

Minimizes the engine window to an iconic representation.

int isMinimized ( ) #

Returns the value indicating if the engine window is minimized to tray.

Return value

1 if the engine window is minimized, otherwise 0.

void maximize ( ) #

Makes the engine window as large as possible.

int isMaximized ( ) #

Returns the value indicating if the engine window is maximized.

Return value

1 if the engine window is maximized, otherwise 0.

void restore ( ) #

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

void setMouseGrab ( int value ) #

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

Arguments

  • int value - 1 if the pointer cannot leave the engine window, otherwise 0.

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 ENGINE_WINDOW_HITTEST_* values.

int getOrder ( ) #

Returns the order of the window. This value allows comparing which window is closer to the viewer (a relatively smaller value).

Return value

The order of the window.

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.

void setGroupUsage ( int usage ) #

Sets the value indicating if the engine window can become a group.

Arguments

  • int usage - 1 to enable usage of the engine window as a group, otherwise 0.

int isGroupUsage ( ) #

Returns the value indicating if the engine window can become a group.

Return value

1 if usage of the engine window as a group is enabled, otherwise 0.

void setNestedUsage ( int usage ) #

Sets the value indicating if the engine window can be used as a nested window.

Arguments

  • int usage - 1 to enable usage of the engine window as a nested window, otherwise 0.

int isNestedUsage ( ) #

Returns the value indicating if the engine window can be used as a nested window.

Return value

1 if usage of the engine window as a nested window is enabled, otherwise 0.

int getNumNestedWindows ( ) #

Returns the total number of nested windows in the group.

Return value

The total number of nested windows in the group.

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.

int 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

1 if the specified window is a direct child of the current one, otherwise 0.

int 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

1 if the specified window is a child of the current one, otherwise 0.

EngineWindow getParentGroup ( ) #

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

Return value

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

EngineWindow getGlobalParentGroup ( ) #

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

Return value

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

int 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

1 if the current window is globally a child of the specified one, otherwise 0.

int getCurrentTab ( ) #

Returns the index of the currently active tab in a tab group.

Return value

The index of the currently active tab.

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.

int 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

1 if the mouse hovers over the current window, otherwise 0.

int 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

1 if the mouse hovers over the client area of the window, otherwise 0.

int getHoverTabBar ( ivec2 global_mouse_pos, ivec2 & out_bar_pos, 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.
  • ivec2 & out_bar_pos - Position of the tab bar.
  • ivec2 & out_bar_size - Size of the tab bar.

Return value

Index of the tab.

int getHoverTabBarArea ( ivec2 global_mouse_pos, ivec2 & out_area_pos, 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.
  • ivec2 & out_area_pos
  • ivec2 & out_area_size

Return value

Index of the tab.

int getNumDroppedItems ( ) #

Returns the total number of files and/or folders dropped to the window.

Return value

The number of dropped files and/or folders.

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.

long getID ( ) #

Returns the ID of the engine window, if the window is external, i.e. not nested in any window and can be moved independently on the desktop.

Return value

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

string getVideoModeName ( ) #

Returns the window size and name of the current video mode.

Return value

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

void screenshot ( string path ) #

Creates a screenshot after the rendering stage is completed.

Arguments

  • string path - Path to save the screenshot.

void setHoldEngine ( int engine ) #

Sets the value indicating if the engine can stop operating (quit automatically) while this window is open.

Arguments

  • int engine - 1 if the engine can't stop operating while this window is open, otherwise 0.

int isHoldEngine ( ) #

Sets the value indicating if the engine can stop operating (quit automatically) while this window is open.

Return value

1 if the engine can't stop operating while this window is open, otherwise 0.

void setIgnoreSystemClose ( int close ) #

Sets the value indicating if this window can be closed using the OS methods (ALT+F4 or cross in the top-right corner of the window).

Arguments

  • int close - If 1, the window can't be closed using the OS methods.

int isIgnoreSystemClose ( ) #

Returns the value indicating if this window can be closed using the OS methods (ALT+F4 or cross in the top-right corner of the window).

Return value

If 1, the window can't be closed using the OS methods.

void disableFullscreen ( ) #

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

int 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

1 if the specified fullscreen mode has been enabled for the specified display; otherwise, 0.

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.

int isModal ( ) #

Checks if the window is modal.

Return value

1 if the window is modal; otherwise, 0.

int isModalParent ( ) #

Checks if this window is parent for any modal window.

Return value

1 if the window is parent for any modal window; otherwise, 0.

EngineWindow getModalParent ( ) #

Returns the modal parent of the window.

Return value

The modal parent of the 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.

int getNumModalWindows ( ) #

Returns the total number of modal windows for this window.

Return value

The total number of modal windows.

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.

int isChild ( Widget widget ) #

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

Arguments

Return value

1 if the widget is the child of the current window; otherwise, 0.

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 ( int 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

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

int 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 ( int top ) #

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

Arguments

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

int 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: ()