This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
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

This base class is used to manage engine windows: their components, relations with other windows, size, position, and other features. The EngineWindow class doesn't provide creating of a window viewport or a window group: you can create them using constructors of the corresponding classes inherited from the EngineWindow class.

The image below demonstrates the window components that can be controlled by the EngineWindow class methods.

Window components

Here are some window examples:

A system-style window

A window (either system or engine style),
borders and title bar disabled

An engine-style window, borders disabled

An engine-style window, borders enabled

The system and engine style windows have the same component layout except the sizing border: in the engine style, it is in the visual part of the window.

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

Source code (C#)
// create an engine window of the specified size with the specified name
EngineWindowViewport window = new EngineWindowViewport("Window", 580, 300);

Then, by using methods of the EngineWindow class, 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 can be nested, or whether it can become a group), define its style (sytem or engine), change the window state (whether it is shown/hidden, minimized/maximized, focused, etc.), manage window intersections and callbacks.

Source code (C#)
// set an icon and a new title for the window 
window.SetIcon(icon);
window.Title = "Vertical Group";

// set a window position and size
window.Position = new ivec2(60, 60);
window.Size = new ivec2(580, 300);

// set window properties
window.CanBeNested = false;
window.CanCreateGroup = false;

// show the window
window.Show();

The created window can remain a separate one, or it can be grouped with the other window(s). The window group is created and managed by means of the EngineWindowGroup class. By using methods of the Enginewindow class, you can specify whether the window can be added to the group, get the parent of the window or remove it from the group.

Source code (C#)
// separate windows
EngineWindowViewport settings = new EngineWindowViewport("Settings", 512, 256);
EngineWindowViewport parameters = new EngineWindowViewport("Parameters", 512, 256);

// grouped windows
EngineWindow settings_and_parameters = WindowManager.StackWindows(settings, parameters, EngineWindowGroup.GROUP_TYPE.TAB);

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

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

EngineWindow Class

Enums

HITTEST#

NameDescription
INVALID = -1The hittest result is invalid.
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.

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.
MOVED = 8Window is moved.
RESIZED = 9Window is resized.
FOCUSED = 10Window gains the focus.
UNFOCUSED = 11Window loses the focus.
MOUSE_ENTER = 12Mouse enters the window area.
MOUSE_LEAVE = 13Mouse leaves the window area.
SHOWN = 14Window is shown.
HIDDEN = 15Window is hidden.
MINIMIZED = 16Window is minimized.
MAXIMIZED = 17Window is maximized.
RESTORED = 18Window is restored.
CLOSE = 19Window is closed.
ITEM_DROP = 20Item is dropped to the window.
UNSTACK_MOVE = 21Window is unstacked and moved.
STACK = 22Window is stacked.
UNSTACK = 23Window is unstacked.
NUM_CALLBACKS = 24Callback counter.

FLAGS#

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

AREA#

NameDescription
NONE = 0None of the areas of the window split into 9 parts is selected.
TOP_LEFT = 1Top left area of the window split into 9 parts.
TOP_CENTER = 2Top center area of the window split into 9 parts.
TOP_RIGHT = 3Top right area of the window split into 9 parts.
CENTER_LEFT = 4Center left area of the window split into 9 parts.
CENTER_CENTER = 5Center area of the window split into 9 parts.
CENTER_RIGHT = 6Center right area of the window split into 9 parts.
BOTTOM_LEFT = 7Bottom left area of the window split into 9 parts.
BOTTOM_CENTER = 8Bottom center area of the window split into 9 parts.
BOTTOM_RIGHT = 9Bottom right area of the window split into 9 parts.

TYPE#

NameDescription
ENGINE_WINDOW = 0Engine window.
ENGINE_WINDOW_VIEWPORT = 1Engine viewport window.
ENGINE_WINDOW_GROUP = 2Engine window group.
NUM_ENGINE_WINDOWS = 3Total number of engine windows.

Properties

Gui Gui#

The Gui instance.

int DisplayIndex#

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

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.

Gui SelfGui#

The Gui instance.

ivec2 Position#

The window screen position (coordinates of the top left corner).

ivec2 ClientPosition#

The screen position of the client (coordinates of the top left corner).

ivec2 ClientLocalPosition#

The screen position of the client (coordinates of the top left corner) relative to the window position.

ivec2 Size#

The engine window size (i.e. including the sizing border).
Notice
This property is for a separate or parent window, for a nested window it will return the value of the global parent group.

ivec2 ClientSize#

The size of the 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 window.

bool BordersEnabled#

The value indicating if the borders are enabled for the engine window.
Notice
This method should be applied to a separate or parent window, for a nested window it will return false.

int BorderSize#

The engine window border size.

bool Resizable#

The value indicating if the engine window is resizable by the mouse.
Notice
This method should be applied to a separate or parent window, for a nested window it will return false.

bool IsShown#

The value indicating if the engine window is rendered.
Notice
This method should be applied to a separate or parent window, for a nested window it will return the value of the global parent group.

bool IsHidden#

The value indicating if the engine window isn't rendered.
Notice
This method should be applied to a separate or parent window, for a nested window it will return the value of the global parent group.

bool IsFocused#

The value indicating if the engine window is in focus.
Notice
This method should be applied to a separate or parent window, for a nested window it will return the value of the global parent group.

bool IsMinimized#

The value indicating if the engine window is minimized.
Notice
This method should be applied to a separate or parent window, for a nested window it will return the value of the global parent group.

bool IsMaximized#

The value indicating if the engine window is maximized.
Notice
This method should be applied to a separate or parent window, for a nested window it will return the value of the global parent group.

int Order#

The order of the window.

EngineWindowGroup ParentGroup#

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

EngineWindowGroup GlobalParentGroup#

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

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. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.
Notice
This method should be applied to a separate or parent window, for a nested window it will return false.

bool IsModal#

The value indicating if the window is modal. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.
Notice
This method should be applied to a separate or parent window, for a nested window it will return false.

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.

ulong ID#

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

bool AlwaysOnTop#

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

bool IsHiddenByTab#

The value indicating if the window is overlapped by any other tab (either by switching to another tab or resizing this window to have zero client area).

bool CanCreateGroup#

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

bool CanBeNested#

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

bool IsSystemFocused#

The value indicating if the engine window is currently in focus.
Notice
This method should be applied to a separate or parent window, for a nested window it will return the value of the global parent group.

int SizingBorderSize#

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

bool EngineStyle#

The value indicating if the engine style is set for the engine window.

bool SystemStyle#

The value indicating if the default system style is set for the engine window.

int TitleBarHeight#

The engine window title bar height.

bool TitleBarEnabled#

The value indicating if the title bar is enabled for the engine window.

string TypeName#

The string representation of the engine window type.

EngineWindow.TYPE Type#

The type of the engine window.

float DpiScale#

The current DPI scale applied to the elements inside the window.

int Dpi#

The current DPI level for the window.

ivec2 MaxRenderSize#

The maximum window size in pixels.

ivec2 MinRenderSize#

The minimum window size in pixels.

ivec2 ClientRenderSize#

The client area size in pixels.

ivec2 RenderSize#

The engine window frame size in pixels.

Members


void MoveToCenter ( ) #

Positions the window so that the client center coincides with the center of the current display.
Notice
This method should be applied to a separate or parent window, using this method for a nested window is not allowed.

void SetMinAndMaxSize ( ivec2 min_size, ivec2 max_size ) #

Sets the minimum and maximum possible window size when resizing the window.
Notice
This method should be applied to a separate or parent window, using this method for a nested window is not allowed.

Arguments

  • ivec2 min_size - The minimum possible size of the window.
  • ivec2 max_size - The maximum possible size of the window.

int SetIcon ( Image image ) #

Sets the icon for the window.

Arguments

  • Image image - The icon for the window.

Return value

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

Image GetIcon ( ) #

Returns the icon for the engine window.

Return value

The icon for the window.1 if the icon for the window is returned successfully, otherwise 0.

void Show ( ) #

Enables rendering of the engine window.
Notice
This method should be applied to a separate or parent window, using this method for a nested window is not allowed.

void Hide ( ) #

Disables rendering of the engine window.
Notice
This method should be applied to a separate or parent window, using this method for a nested window is not allowed.

void SetFocus ( ) #

Sets the focus to the window.

void SetSystemFocus ( ) #

Sets the focus to the engine window.
Notice
This method is applied to a separate or parent window, for nested windows use setFocus().

void Minimize ( ) #

Minimizes the engine window to an iconic representation.
Notice
This method should be applied to a separate or parent window, using this method for a nested window is not allowed.

void Maximize ( ) #

Makes the engine window as large as possible.
Notice
This method should be applied to a separate or parent window, using this method for a nested window is not allowed.

void Restore ( ) #

Restores the size and position of the minimized or maximized engine window via the system proxy.
Notice
This method should be applied to a separate or parent window, using this method for a nested window is not allowed.

EngineWindow.HITTEST GetHitTestResult ( ivec2 global_pos ) #

Returns a value indicating in which area of the engine window the mouse is located.
Notice
This method is used for interaction with system windows only, i.e. it cannot be used for nested windows.

Arguments

  • ivec2 global_pos - Global coordinates of the hit-test point.

Return value

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

string GetHitTestResultName ( EngineWindow.HITTEST hit_test ) #

Returns the string representation of the hit test result value.

Arguments

Return value

The string representation of the hit test result value (e.g., HITTEST_RESIZE_RIGHT is RESIZE RIGHT).

void ToTop ( ) #

Makes the window appear on top of all other windows.
Notice
This method should be applied to a separate or parent window, using this method for a nested window is not allowed.

bool IsGlobalChildOf ( EngineWindowGroup group ) #

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

Arguments

Return value

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

void UpdateGuiHierarchy ( ) #

Updates the hierarchy for all widgets — the widgets are arranged, expanded to the required sizes and then their positions are updated. Updating the hierarchy may be required, for example, for getting the screen position immediately after the widget has been added to the hierarchy. For a separate window, the hierarchy in self gui is updated; for a nested window, the hierarchy in self gui of the global parent group is updated.

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.
Notice
This method should be applied to a separate or parent window, using this method for a nested window is not allowed.

Arguments

  • string path - Path to save the screenshot.

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. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.
Notice
This method should be applied to a separate or parent window, a nested window can't be a parent for a modal window.

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. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.
Notice
This method should be applied to a separate or parent window, a nested window can't be a parent for a modal window.

Arguments

  • EngineWindow window - Window to be added as modal.

void RemoveModalWindow ( EngineWindow window ) #

Removes the argument modal window from this window. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.
Notice
This method should be applied to a separate or parent window, a nested window can't be a parent for a modal window.

Arguments

  • EngineWindow window - Engine window.

EngineWindow GetModalWindow ( int index ) #

Returns the modal window for this window by its index. The concept of modal assumes that if a window has modal children, it cannot be closed. Any other interaction with a parent window is possible.
Notice
This method should be applied to a separate or parent window, for a nested window it will return nullptr.

Arguments

  • int index - Index of the modal window.

Return value

Modal window.

void Unstack ( ) #

Removes the current window from a parent group.

void Close ( ) #

Deletes the window if this window is not a modal parent or a member of a fixed group. If a window is a member of a fixed group, it cannot be closed (i.e. deleted).

bool GetIntersection ( 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 GetClientIntersection ( ivec2 global_mouse_pos ) #

Returns the value indicating if the mouse is hovering over the client area of the window.
Source code (C#)
//checks if the mouse is hovering over the main window
EngineWindow main_window = WindowManager.MainWindow;
main_window.GetClientIntersection(Input.MousePosition);

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.

EngineWindow.AREA GetClient9Area ( ivec2 global_mouse_pos ) #

Returns the area over which the mouse hovers, one of the nine areas into which the window is segmented.

Arguments

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

Return value

One of the nine segments the screen area is split into.

string Get9AreaName ( EngineWindow.AREA area ) #

Returns the name of the screen segment as a string.

Arguments

Return value

The string representation of the segment value (e.g., AREA_TOP_LEFT is TOP LEFT).

ivec2 GlobalToLocalUnitPosition ( ivec2 global_pos ) #

Transforms the global screen coordinates in pixels into units relative to the window client area.

Arguments

  • ivec2 global_pos - The position in global coordinates.

Return value

The coordinates in units relative to the window client area.

ivec2 LocalUnitToGlobalPosition ( ivec2 unit_pos ) #

Transforms the position in units relative to the window client area into the global screen coordinates in pixels.

Arguments

  • ivec2 unit_pos - The coordinates in units relative to the window client area.

Return value

The position in global coordinates.

ivec2 GetRenderSize ( ) #

Returns the engine window frame size in pixels.

Return value

The engine window frame size in pixels.

ivec2 GetClientRenderSize ( ) #

Returns the client area size in pixels.

Return value

The client area size in pixels.

ivec2 GetMinRenderSize ( ) #

Returns the minimum window size in pixels.

Return value

The minimum window size in pixels.

ivec2 GetMaxRenderSize ( ) #

Returns the maximum window size in pixels.

Return value

The maximum window size in pixels.

int GetDpi ( ) #

Returns the current DPI level for the window.

Return value

The current DPI level for the window.

float GetDpiScale ( ) #

Returns the current DPI scale applied to the elements inside the window.

Return value

The current DPI scale applied to the elements inside the window.

int ToRenderSize ( int unit_size ) #

Transforms the unit value to the pixel value.

Arguments

  • int unit_size - Size in units.

Return value

Size in pixels.

int ToUnitSize ( int render_size ) #

Transforms the pixel value to the unit value.

Arguments

  • int render_size - Size in pixels.

Return value

Size in units.

ivec2 ToRenderSize ( ivec2 unit_size ) #

Transforms the unit value to the pixel value.

Arguments

  • ivec2 unit_size - Size in units.

Return value

Size in pixels.

ivec2 ToUnitSize ( ivec2 render_size ) #

Transforms the pixel value to the unit value.

Arguments

  • ivec2 render_size - Size in pixels.

Return value

Size in units.
Last update: 2023-07-06
Build: ()