Unigine.Gui Class
Creates a GUI. Different types of GUI widgets can be either added to one of the following:
- To the system GUI (Unigine user interface) that is rendered on top of application window.
- To the GUI object positioned in the world. In this case, any postprocessing filter can be applied.
Gui Class
Enums
CALLBACK_INDEX#
Name | Description |
---|---|
SHOW = 0 | Callback is used when a widget is shown. Supported by all widgets. |
HIDE = 1 | Callback is used when a widget is removed via Gui::removeChild(). Supported by all widgets. |
FOCUS_IN = 2 | Callback is used when a widget is focused. Supported by all widgets. |
FOCUS_OUT = 3 | Callback is used when a widget loses focus. Supported by all widgets. |
CHANGED = 4 | Callback is used when a widget has changed its state. Supported by the following widgets:
|
CLICKED = 5 | Callback is used when the mouse is clicked somewhere on a widget. Supported by the following widgets:
|
DOUBLE_CLICKED = 6 | Callback is used when the mouse is double-clicked somewhere on a widget. Supported by the following widgets: |
PRESSED = 7 | Callback is used when a mouse button or ENTER (RETURN) is pressed, while the mouse pointer is somewhere on a widget. Supported by the following widgets: |
RELEASED = 8 | Callback is used when the mouse was released after clicking somewhere on a widget. Supported by the following widgets: |
KEY_PRESSED = 9 | Callback us used when a key is pressed while a widget is in focus. Supported by the following widgets: |
ENTER = 10 | Callback is used when the mouse pointer enters a widget. Supported by all widgets. |
LEAVE = 11 | Callback is used when the mouse pointer leaves a widget. Supported by all widgets. |
DRAG_MOVE = 12 | Callback is used when a focused widget is moved. |
DRAG_DROP = 13 | Callback is used when a drag-and-drop operation is performed with a widget. Supported by all widgets. A callback can receive dragged widgets inside additional arguments. Clicked or pressed callbacks receive a mouse button or a key inside an additional callback argument. |
NUM_CALLBACKS = 14 |
Properties
int NumChildren#
The number of widgets in the gui.
int MouseGrab#
A value indicating if the mouse pointer is bound to the gui.
set
Sets a value indicating if the mouse pointer is bound to the GUI.
set value -
Positive integer, if the mouse pointer cannot leave the GUI; otherwise, 0.
int MouseButton#
The mouse button, which input is received.
set
Sets a mouse button, which input should be received.
int MouseCursor#
One of the CURSOR_* pre-defined variables.
set
Sets a mouse pointer to display.
set value -
One of the GUI_CURSOR_* pre-defined variables.
WidgetSprite MouseSprite#
The custom mouse pointer currently in use.
set
Sets a custom mouse pointer.
set value -
Sprite with a custom mouse pointer or NULL (0) to fall back to the standard mouse pointer.
bool MouseEnabled#
A value indicating if the mouse cursor is rendered.
set
Enables or disables rendering of the mouse cursor.
set value -
Positive value to enable rendering of the mouse; otherwise, 0.
float ToolTipTime#
The delay before tooltip appearing.
set
Sets a delay before tooltip appearance.
set value -
Delay in cycles per second.
float ToolTipAlpha#
The alpha value of a tooltip.
set
Sets an alpha value for tooltips. The default is 0.95 (translucent).
set value -
Alpha value. 0 means completely transparent.
vec4 ToolTipColor#
The font color of a tooltip.
set
Sets a font color for tooltips. The default is equivalent to #000000 (black).
set value -
Font color.
int ToolTipWidth#
The current width of the tooltip.
set
Sets the width for the tooltip.
set value -
New tooltip width.
int ToolTipSize#
The font size of a tooltip.
set
Sets a font size for widgets.
set value -
Font size.
bool ToolTipEnabled#
A value indicating if tooltips are available or not.
set
Sets a value indicating whether tooltips are available or not.
set value -
1 to enable the tooltip; otherwise, 0.
float TransparentAlpha#
The alpha value of a transparent widget. a widget is transparent, if it uses blending.
set
Sets an alpha value for transparent widgets. A widget is transparent, if it uses blending. The default is 0.8 (translucent).
set value -
Alpha value. 0 means completely transparent.
vec4 TransparentColor#
The font color of a transparent widget. a widget is transparent, if it uses blending.
set
Sets a font color for transparent widgets. A widget is transparent, if it uses blending. The default is equivalent to #869caa (light bluish).
set value -
Font color.
bool TransparentEnabled#
A value indicating if a widget can be rendered as transparent (i.e. change its color accordingly), when necessary. For example, it can indicate whether the drop-down list of combobox is transparent or not.
set
Sets a value indicating if a widget can be rendered as transparent (i.e. change its color accordingly), when necessary. For example, this function allows to control whether the drop-down list of combobox is transparent or not.
set value -
Positive value if the widget can be rendered as transparent; otherwise, 0.
float DisabledAlpha#
The alpha value of a disabled widget.
set
Sets an alpha value for disabled widgets.
set value -
Alpha value. 0 means completely transparent.
vec4 DisabledColor#
The font color of a disabled widget.
set
Sets a font color for disabled widgets. The default is equivalent to #869caa (light bluish).
set value -
Font color.
bool DisabledEnabled#
A value indicating if a widget can be rendered as disabled (i.e. change its color accordingly), when necessary.
set
Sets a value indicating if a widget can be rendered as disabled (i.e. change its color accordingly), when necessary.
set value -
Positive value if the widget can be rendered as disabled; otherwise, 0.
float FocusedAlpha#
The alpha value of a focused widget.
set
Sets an alpha value for focused widgets. The default is 1 (completely opaque).
set value -
Alpha value. 0 means completely transparent.
vec4 FocusedColor#
The font color of a focused widget.
set
Sets an font color for focused widgets. The default is equivalent to #ffffff (white).
set value -
Font color.
bool FocusedPermanent#
A value indicating if the permanent color of the focused widget is changed.
set
Changes the permanent color of the focused widget.
set value -
1 - a font color is overridden with the global GUI focused color; 0 - a font color is unchanged.
bool FocusedEnabled#
A value indicating if a widget can be rendered as focused on (i.e. change its color accordingly), when necessary.
set
Sets a value indicating if a widget can be rendered as focused on (i.e. change its color accordingly), when necessary.
set value -
Positive value if the widget can be rendered as focused on; otherwise, 0.
float DefaultAlpha#
The standard alpha value of a widget.
set
Sets a standard alpha value for widgets.
set value -
Alpha value. 0 means completely transparent.
vec4 DefaultColor#
The standard font color of a widget.
set
Sets a standard font color for widgets. The default is equivalent to #ddddff (blue-white).
set value -
Font color.
int DefaultSize#
The standard font size of a widget.
set
Sets a standard font size for widgets.
set value -
Font size.
float FadeOutSpeed#
The duration of fade-out animation played when a widget loses focus.
set
Sets a duration of fade-out animation played when the widget loses focus.
set value -
Duration in cycles per second, for example, 4 means that the duration is a 1/4 of a second.
float FadeInSpeed#
The duration of fade-in animation played when a widget gets focused.
set
Sets a duration of fade-in animation played when the widget gets focused.
set value -
Duration in cycles per second, for example, 8 means that the duration is a 1/8 of a second.
float ExposeSpeed#
The duration of animation played when a widget appears.
set
Sets a duration of animation played when the widget appears.
set value -
Duration in cycles per second, for example, 6 means that the duration is a 1/6 of a second.
mat4 Transform#
Gui transformation matrix.
set
Sets the global GUI transformation matrix. This 2D matrix can be tilted, rotated, moved or modified in many ways in 3D space.
set value -
Transformation matrix.
vec4 Color#
The color of the global color multiplier.
set
Sets a color for the global color multiplier. The default is equivalent to #ffffff (white).
set value -
Multiplier color.
int Height#
The current screen height.
int Width#
The current screen width.
bool Hidden#
A value indicating if a widget is rendered visible.
set
Sets a value indicating if a widget should not be rendered.
set value -
Positive integer to render the widget; 0 not to render.
bool Enabled#
A value indicating if the gui is enabled.
set
Sets a value indicating if a widget should be enabled/disabled.
set value -
Positive integer to enable the widget; 0 to disable.
bool IsActive#
Returns a value indicating if any widget in the GUI is in focus.
WidgetVBox VBox#
Returns the root widget of the GUI (WidgetVBox).
Widget PermanentFocus#
A widget that is always in focus.
Widget OverlappedFocus#
The widget placed under the currently focused widget.
Widget Focus#
The widget that is currently in focus.
int MouseDY#
The difference between the previous position of the mouse pointer and the current one along the y axis.
int MouseDX#
The difference between the previous position of the mouse pointer and the current one along the x axis.
int MouseY#
The current y coordinate of the mouse pointer in the coordinate system of the application window.
int MouseX#
The current x coordinate of the mouse pointer in the coordinate system of the application window.
int ToolTipY#
Gets GUI ToolTip Y position.
set
Sets the ToolTip position along the Y axis.
set value -
New Y coordinate of the ToolTip to be set.
int ToolTipX#
Gets GUI ToolTip X position.
set
Sets the ToolTip position along the X axis.
set value -
New X coordinate of the ToolTip to be set.
string ToolTipText#
Gets GUI ToolTip text.
set
Sets a new text for the tooltip.
set value -
Text for the tooltip to be set.
Members
Gui get ( ) #
Returns a pointer to the GUI.Return value
Pointer to the GUI.bool IsActive ( ) #
Returns a value indicating if any widget in the GUI is in focus.Return value
true if any widget is focused; otherwise, false.Widget GetChild ( int num ) #
Returns a child widget with a given number.Arguments
- int num - Widget number.
Return value
Child widget.int IsChild ( Widget widget ) #
Checks if a given widget is a child of the current GUI.Arguments
- Widget widget - Widget to check.
Return value
Returns 1 if the given widget is a child; otherwise, 0.int SetFont ( string name ) #
Changes the font used in the system GUI.Arguments
- string name - Path to the font file.
Return value
1 if the font is successfully changed; otherwise, 0.int GetKeyActivity ( uint key ) #
Checks if a given key already has a special purpose for the widget in focus.Arguments
- uint key - One of the standard ASCII control codes or one of the APP_KEY_* pre-defined variables.
Return value
1 if the key cannot be used; otherwise, 0.int SetResource ( string name ) #
Changes the resource skin file used in the system GUI.Arguments
- string name - Path to the *.rc file.
Return value
1 if the resource file is successfully changed; otherwise, 0.int SetSkin ( string name ) #
Changes the GUI skin used in the system GUI.Arguments
- string name - Path to the directory where the skin files are stored (an RC file and textures).
Return value
1 if the skin is successfully changed; otherwise, 0.void SetToolTip ( int x, int y, string str ) #
Sets a tooltip.Arguments
- int x - Screen position along the X axis.
- int y - Screen position along the Y axis.
- string str - Tooltip to display.
int GetToolTipHeight ( string str ) #
Returns a height of the given tooltip.Height of a single-line tooltip is equal to 21 pixels.
Arguments
- string str - A tooltip text.
Return value
Height of the given tooltip (in pixels).void SetToolTipText ( string text ) #
Sets a new text for the tooltip.Arguments
- string text - Text for the tooltip to be set.
int GetToolTipWidth ( string str ) #
Returns the current width of the tooltip.Arguments
- string str - A tooltip text.
Return value
Width of the tooltip.void SetToolTipX ( int tooltipx ) #
Sets the ToolTip position along the X axis.Arguments
- int tooltipx - New X coordinate of the ToolTip to be set.
void SetToolTipY ( int tooltipy ) #
Sets the ToolTip position along the Y axis.Arguments
- int tooltipy - New Y coordinate of the ToolTip to be set.
WidgetVBox GetVBox ( ) #
Returns the root widget of the GUI (WidgetVBox).Return value
Root widget of the GUI.void AddChild ( Widget widget, int flags = 0 ) #
Adds a given widget to the GUI.Arguments
- Widget widget - Widget to add.
- int flags - One of the GUI_ALIGN_* pre-defined variables. This is an optional parameter.
int AddDictionary ( string name, string language = 0 ) #
Adds a new dictionary with localized interface strings. Dictionaries cannot be modified in run-time.Arguments
- string name - Path to the dictionary file.
- string language - Name of the dictionary language.
Return value
Returns 1 if the dictionary is added successfully; otherwise, 0.void ClearDictionaries ( ) #
Clears all dictionaries.int ClearTexture ( string name ) #
Clears the specified GUI texture file cache.Arguments
- string name - Name of the texture.
Return value
1 if the texture is successfully cleared; otherwise, 0.Gui Create ( string name = 0 ) #
GUI constructor.Arguments
- string name - GUI skin name.
Return value
Pointer to the created GUI.void Destroy ( ) #
Destroys all GUI resources.void Disable ( ) #
Disables GUI rendering.void Enable ( int width, int height ) #
Enables GUI rendering.Arguments
- int width - GUI width.
- int height - GUI height.
int HasTranslation ( string arg1 ) #
Returns a value indicating if there is translation for a given string in the localization dictionary.Arguments
- string arg1 - String to check.
Return value
1 if there is translation for the given string; otherwise, 0.vec4 ParseColor ( string str ) #
Converts a color string in the Web format (RRGGBB / #RRGGBB or RRGGBBAA / #RRGGBBAA) into its vec4 equivalent.Arguments
- string str - Color string in the Web format.
Return value
Color value as a vec4 vector (R, G, B, A).void RemoveChild ( Widget widget ) #
Removes the specified widget from the GUI.Arguments
- Widget widget - Child widget to be removed.
void RemoveFocus ( ) #
Removes focus from the GUI.void Render ( int mouse_x, int mouse_y, int mouse_button, int mouse_show ) #
Renders GUI with specified parameters.Arguments
- int mouse_x - X mouse position.
- int mouse_y - Y mouse position.
- int mouse_button - Pressed mouse button.
- int mouse_show - Show mouse cursor flag.
void ReplaceChild ( Widget widget, Widget old_widget, int flags = 0 ) #
Replaces a given widget in the GUI with another widget.Arguments
- Widget widget - Replacement widget.
- Widget old_widget - Widget to be replaced.
- int flags - One of the GUI_ALIGN_* pre-defined variables. This is an optional parameter.
int SaveDictionary ( string name, string language = 0 ) #
Saves the current dictionary on disk. This function can be used to save the currently loaded dictionary into another file.Arguments
- string name - Path to a dictionary file.
- string language - Name of the dictionary language.
Return value
1 if the dictionary is saved successfully; otherwise, 0.string Translate ( string str ) #
Returns the source string translated using the dictionary.Arguments
- string str - String to translate (source).
Return value
Target (translated) string if it is found in the localization dictionary; otherwise, the source string.void Update ( float ifps ) #
Updates GUI.Arguments
- float ifps - Inverse FPS counter.
bool IsRenderingBootScreen ( ) #
Returns a value indicating if the GUI currently renders the boot screen.Return value
true if the GUI currently renders the boot screen; otherwise, false.bool IsRenderingSplashScreen ( ) #
Returns a value indicating if the GUI currently renders the splash screen.Return value
true if the GUI currently renders the splash screen; otherwise, false.bool IsRenderingLoadingScreen ( ) #
Returns a value indicating if the GUI currently renders the loading screen.Return value
true if the GUI currently renders the loading screen; otherwise, false.Last update:
2021-04-29
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)