Arguments

intgetMouseCursor()

Return value

intgetMouseDX()

Returns the difference between the previous position of the mouse pointer and the current one along the X-axis.

Return value

Difference along the X-axis.

intgetMouseDY()

Returns the difference between the previous position of the mouse pointer and the current one along the Y-axis.

Return value

Difference along the Y-axis.

voidsetMouseEnabled(intenabled)

Enables or disables rendering of the mouse cursor.

Arguments

intenabled - 1 to enable the mouse, 0 to disable it.

intisMouseEnabled()

Returns a value indicating if the mouse cursor is rendered.

Return value

1 if the mouse is rendered; otherwise, 0.

voidsetMouseGrab(intgrab)

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

Arguments

intgrab - 1 if the mouse pointer cannot leave the GUI; otherwise, 0.

intgetMouseGrab()

Returns a value indicating if the mouse pointer is bound to the GUI.

Return value

1 if the mouse pointer cannot leave the GUI; otherwise, 0.

voidsetMouseSprite(const Ptr<WidgetSprite> &sprite)

Sets a custom mouse pointer.

Arguments

const Ptr<WidgetSprite> &sprite - Sprite with a custom mouse pointer, or NULL to fall back to the standard mouse pointer.

Ptr<WidgetSprite>getMouseSprite()

Returns the custom mouse pointer currently in use.

Return value

Sprite with a custom mouse pointer, or NULL if the standard mouse pointer is used.

intgetMouseX()

Returns the current X-coordinate of the mouse pointer in the coordinate system of the application window.

Return value

X-coordinate of the mouse pointer.

intgetMouseY()

Returns the current Y-coordinate of the mouse pointer in the coordinate system of the application window.

Return value

Y-coordinate of the mouse pointer.

intgetNumChildren()

Returns the number of widgets in the GUI.

Return value

Number of widgets.

Ptr<Widget>getOverlappedFocus()

Returns the widget placed under the currently focused widget.

Return value

Overlapped widget.

intisOwner()

Ptr<Widget>getPermanentFocus()

Returns a widget that is always in focus.

Return value

Widget always in focus.

intsetResource(const char *name)

Changes the resource skin file used in the system GUI.

Arguments

const char *name - Path to the rc file.

Return value

1 if the resource file is successfully changed; otherwise, 0.

intsetSkin(const char *name)

Changes the GUI skin used in the system GUI.

Arguments

const char *name - Path to the skin file (an RC file and textures).

Return value

1 if the skin is successfully changed; otherwise, 0.

voidsetToolTip(intx, inty, const char *str)

Sets a tooltip.

Arguments

intx - X coordinate of the tooltip position.

inty - Y coordinate of the tooltip position.

const char *str - ToolTip text.

voidsetToolTipAlpha(floatalpha)

Sets an alpha value for tooltips. The default is 0.95 (translucent).

Arguments

floatalpha - Alpha value. 0 means completely transparent.

floatgetToolTipAlpha()

Returns the alpha value of a tooltip.

Return value

Alpha value.

voidsetToolTipColor(const Math::vec4 &color)

Sets a font color for tooltips. The default is equivalent to #000000 (black).

Arguments

const Math::vec4 &color - Font color.

Math::vec4getToolTipColor()

Returns the font color of a tooltip.

Return value

Font color.

voidsetToolTipEnabled(intenabled)

Sets a value indicating whether tooltips are available or not.

Arguments

intenabled - 1 to enable tooltips; otherwise, 0.

intisToolTipEnabled()

Returns a value indicating if tooltips are available or not.

Return value

Return 1 if tooltips are enabled; otherwise, 0.

intgetToolTipHeight(const char *str)

Returns a height of the given tooltip.

Notice

Height of a single-line tooltip is equal to 21 pixels.

Arguments

const char *str - A tooltip text.

Return value

Height of the given tooltip (in pixels).

voidsetToolTipSize(intsize)

Sets a font size for widgets.

Arguments

intsize - Font size.

intgetToolTipSize()

Returns the font size of a tooltip.

Return value

Font size.

const char *getToolTipText()

Gets GUI ToolTip text.

Return value

GUI ToolTip text.

voidsetToolTipTime(floattime)

Sets a delay before tooltip appearance.

Arguments

floattime - Delay in cycles per second.

floatgetToolTipTime()

Returns the delay before tooltip appearing.

Return value

Delay in cycles per second.

voidsetToolTipWidth(intwidth)

Sets the width for the tooltip.

Arguments

intwidth - New tooltip width.

intgetToolTipWidth(const char *str)

Returns the current width of the tooltip.

Arguments

const char *str - A tooltip text.

Return value

Width of the tooltip.

intgetToolTipWidth()

Returns the current width of the tooltip.

Return value

Width of the tooltip.

intgetToolTipX()

Gets GUI ToolTip X position.

Return value

GUI ToolTip X position.

intgetToolTipY()

Gets GUI ToolTip Y position.

Return value

GUI ToolTip Y position.

voidsetTransform(const Math::mat4 &transform)

Sets the global GUI transformation matrix. This 2D matrix can be tilted, rotated, moved or modified in many ways in 3D space.

Arguments

const Math::mat4 &transform - Transformation matrix.

Math::mat4getTransform()

Returns GUI transformation matrix.

Return value

GUI transformation matrix.

voidsetTransparentAlpha(floatalpha)

Sets an alpha value for transparent widgets. A widget is transparent, if it uses blending. The default is 0.8 (translucent).

Arguments

floatalpha - Alpha value. 0 means completely transparent.

floatgetTransparentAlpha()

Returns the alpha value of a transparent widget. A widget is transparent, if it uses blending.

Return value

Alpha value.

voidsetTransparentColor(const Math::vec4 &color)

Sets a font color for transparent widgets. A widget is transparent, if it uses blending. The default is equivalent to #869caa (light bluish).

Arguments

const Math::vec4 &color - Font color.

Math::vec4getTransparentColor()

Returns the font color of a transparent widget. A widget is transparent, if it uses blending.

Return value

Font color of a transparent widget.

voidsetTransparentEnabled(intenabled)

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.

Arguments

intenabled - Positive value if the widget can be rendered as transparent; otherwise, 0.

intisTransparentEnabled()

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

Return value

1 if the widget can be rendered as transparent; otherwise, 0.

intgetWidth()

Returns the current screen width.

Return value

Screen width, in pixels.

voidaddChild(const Ptr<Widget> &widget, intflags = 0)

Adds a given widget to the GUI.

Arguments

const Ptr<Widget> &widget - Widget to add.

intflags - One of the ALIGN_* pre-defined variables. This is an optional parameter.

intaddDictionary(const char *name, const char *language = 0)

Adds a new dictionary with localized interface strings. Dictionaries cannot be modified in run-time.

Arguments

const char *name - Path to the dictionary file.

const char *language - Name of the dictionary language.

Return value

Returns 1 if the dictionary is added successfully; otherwise, 0.

voidclearDictionaries()

Clears all dictionaries.

intclearTexture(const char *name)

Clears the specified GUI texture file cache.

Arguments

const char *name - Texture name.

Return value

1 if the texture is successfully cleared; otherwise, 0.

Ptr<Gui>create(const char *name = 0)

GUI constructor.

Arguments

const char *name - GUI skin name.

Return value

Pointer to the created GUI.

voiddestroy()

Destroys all GUI resources.

voiddisable()

Disables GUI rendering.

voidenable(intwidth, intheight)

Enables GUI rendering.

Arguments

intwidth - GUI width.

intheight - GUI height.

voidgrab()

Sets the owner flag to 1 for the GUI pointer. The GUI should not be handled by the class after this function is called

inthasTranslation(const char *arg1)

Returns a value indicating if there is translation for a given string in the localization dictionary.

Arguments

const char *arg1 - String to check.

Return value

1 if there is translation for the given string; otherwise, 0.

Math::vec4parseColor(const char *str)

Converts a color string in the Web format (RRGGBB / #RRGGBB or RRGGBBAA / #RRGGBBAA) into its vec4 equivalent.

Arguments

const char *str - Color string in the Web format.

Return value

Color value in vec4.

voidrelease()

Sets the owner flag to 0 for the GUI pointer. The GUI should be handled by the class after this function is called.

Arguments

intflags - One of the ALIGN_* pre-defined variables. This is an optional parameter.

intsaveDictionary(const char *name, const char *language = 0)

Saves the current dictionary on disk. This function can be used to save the currently loaded dictionary into another file.

Arguments

const char *name - Name of the dictionary language.

const char *language - Dictionary language name.

Return value

Returns 1 if the dictionary is saved successfully; otherwise, 0.

const char *translate(const char *str)

Translates the string using dictionary.

Arguments

const char *str - String to translate.

Return value

Target (translated) string if it is found in the localization dictionary; otherwise, the source string.

voidupdate(floatifps)

Updates GUI.

Arguments

floatifps - Inverse FPS counter.

int ALIGN_BACKGROUND

Description

Widget is always placed under other widgets. If clicked on, it does not pop up. Use this flag together with ALIGN_OVERLAP one.

int ALIGN_BOTTOM

Description

Widget is aligned to the bottom of its container.

int ALIGN_CENTER

Description

Widget is centered relative to its container.

int ALIGN_EXPAND

Description

Widget occupies all available space inside its container.

int ALIGN_FIXED

Description

Widget in focus stays on the background or on the foreground (depending on where it was created). This flag is valid only if GUI_ALIGN_OVERLAP is also set. Non-fixed overlapping windows can pop over the fixed ones, while the latter cannot do it.

int ALIGN_LEFT

Description

Widget is aligned to the left side of its container.

int ALIGN_OVERLAP

Description

Widget is rendered over other widgets, on the foreground (or over the contents of the parent container). Overlapping widgets are sorted between each other (i.e. pop up when focused on). This flag also makes the window movable.

int DRAG_DROP

Description

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.

int DRAG_MOVE

Description

Callback is used when a focused widget is moved.

int ENTER

Description

Callback is used when the mouse pointer enters a widget. Supported by all widgets.

int FOCUS_IN

Description

Callback is used when a widget is focused. Supported by all widgets.

int FOCUS_OUT

Description

Callback is used when a widget loses focus. Supported by all widgets.

int HIDE

Description

Callback is used when a widget is removed via Gui::removeChild(). Supported by all widgets.

int HORIZONTAL

Description

Widget has horizontal orientation.

int KEY_PRESSED

Description

Callback us used when a key is pressed while a widget is in focus. Supported by the following widgets: