UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials

Unigine::Gui Class

Interface for gui.

To use this class, include the UnigineGui.h file.

Unigine::Gui Class

Members


virtual ~Gui ()

Virtual destructor.

static Ptr< Gui > get ()

Return a pointer to the Gui.

Return value

Pointer to the Gui.

static Ptr< Gui > create ()

Gui constructor.

Return value

Pointer to the created gui.

virtual void grab () =0

Grab Gui. The Gui should not be handled by the engine after this function is called.

virtual void release () =0

Release Gui. The Gui should be handled by the engine after this function is called.

virtual int isOwner () const =0

Return the "owner" flag.

Return value

Returns the "owner" flag.

virtual void enable (int width, int height) const =0

Enable gui rendering.

Arguments

  • int width - Gui width.
  • int height - Gui height.

virtual void disable () const =0

Disable gui rendering.

virtual void destroy () const =0

Destroy All gui resources.

virtual void update (float ifps) const =0

Update gui.

Arguments

  • float ifps - Inverse FPS counter.

virtual void render (int mouse_x, int mouse_y, int mouse_button, int mouse_show) const =0

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

virtual void setEnabled (int enable) const =0

Enable or disable the Gui.

Arguments

  • int enable - 1 to enable the Gui, 0 to disable it.

virtual int isEnabled () const =0

Return a value indicating if the Gui is enabled.

Return value

Return 1 if the Gui is enabled; otherwise, 0 is returned.

virtual void setHidden (int hidden) const =0

Hide or show the Gui.

Arguments

  • int hidden - 1 to show the Gui, 0 to hide it.

virtual int isHidden () const =0

Return a value indicating if the Gui is hidden.

Return value

Return 1 if the Gui is hidden; otherwise, 0 is returned.

virtual int getWidth ( Screen) const =0

Get screen width.

Arguments

  • Screen - width.

virtual int getHeight ( Screen) const =0

Get screen height.

Arguments

  • Screen - height.

virtual void setColor (const vec4 & color) const =0

Set Gui color multiplier.

Arguments

  • const vec4 & color - Gui color multiplier.

virtual vec4 getColor () const =0

Return Gui color multiplier.

Return value

Gui color multiplier.

virtual void setTransform (const mat4 & transform) const =0

Set Gui transformation matrix.

Arguments

  • const mat4 & transform - Gui transformation matrix.

virtual mat4 getTransform () const =0

Return Gui transformation matrix.

Return value

Gui transformation matrix.

virtual void setToolTip (int x, int y, const char * str) const =0

Sets Gui ToolTip.

Arguments

  • int x - ToolTip X position.
  • int y - ToolTip Y position.
  • const char * str - ToolTip text.

virtual void setMouseEnabled (int enable) const =0

Enables or disables rendering of the mouse. The default is 1.

Arguments

  • int enable - 1 to enable the mouse, 0 to disable it.

virtual int isMouseEnabled () const =0

Return a value indicating if the mouse is enabled.

Return value

Return 1 if the mouse is enabled; otherwise, 0 is returned.

virtual void setMouseSprite (const Ptr< WidgetSprite > & widget) const =0

Sets custom mouse WidgetSprite.

Arguments

  • const Ptr< WidgetSprite > & widget - Widget smart pointer.

virtual Ptr< WidgetSprite > getMouseSprite () const =0

Gets custom mouse WidgetSprite.

Return value

Custom mouse WidgetSprite.

virtual void setMouseCursor (int cursor) const =0

Set mouse cursor.

Arguments

  • int cursor - Mouse cursor.

virtual int getMouseCursor () const =0

Get mouse cursor.

Return value

Mouse cursor.

virtual void setMouseButton (int button) const =0

Set mouse button.

Arguments

  • int button - Mouse button.

virtual int getMouseButton () const =0

Get mouse button.

Return value

Mouse button.

virtual void setMouseGrab (int grab) const =0

Set mouse grab.

Arguments

  • int grab - Mouse grab.

virtual int getMouseGrab () const =0

Get mouse grab.

Return value

Mouse grab.

virtual int getMouseX () const =0

Gets mouse horizontal position.

Return value

Mouse horizontal position.

virtual int getMouseY () const =0

Gets mouse vertical position.

Return value

Mouse vertical position.

virtual int getMouseDX () const =0

Gets mouse horizontal movement.

Return value

Mouse horizontal movement.

virtual int getMouseDY () const =0

Gets mouse vertical movement.

Return value

Mouse vertical movement.

virtual Ptr< Widget > getFocus () const =0

Gets focused widget.

Return value

Focused widget smart pointer.

virtual Ptr< Widget > getOverlappedFocus () const =0

Gets overlapped focused widget.

Return value

Overlapped focused widget.

virtual Ptr< Widget > getPermanentFocus () const =0

Gets permanent focused widget.

Return value

Permanent focused widget.

virtual void removeFocus () const =0

Removes focus from the Gui.

virtual void addChild (const Ptr< Widget > & widget, int flags) const =0

Adds a child to the Gui.

Arguments

  • const Ptr< Widget > & widget - Widget smart pointer.
  • int flags - Widget flags.

virtual void removeChild (const Ptr< Widget > & widget) const =0

Removes a child widget from the list of children.

Arguments

  • const Ptr< Widget > & widget - Child widget smart pointer to remove.

virtual void replaceChild (const Ptr< Widget > & widget, const Ptr< Widget > & old_widget, int flags) const =0

Replaces a child widget from the list of children to another.

Arguments

  • const Ptr< Widget > & widget - Widget smart pointer.
  • const Ptr< Widget > & old_widget - Child widget to replace.
  • int flags - Widget flags.

virtual int isChild (const Ptr< Widget > & widget) const =0

Checks if a given widget is a child of the current Gui.

Arguments

  • const Ptr< Widget > & widget - Widget to check.

Return value

Returns 1 if the given widget is a child; otherwise, 0.

virtual int getNumChilds () const =0

Returns the number of child widgets.

Return value

Number of child widgets.

virtual Ptr< Widget > getChild (int num) const =0

Returns the widget child by its number.

Arguments

  • int num - Number of the widget.

Return value

Child widget.

virtual int getActivity () const =0

Returns a value indicating if any widget in the Gui is in focus.

Return value

The result.

virtual int getKeyActivity () const =0

Checks if a given key already has a special purpose for the widget in focus.

Return value

The result.

virtual int setFont (const char * name) const =0

Sets the default font used to render text.

Arguments

  • const char * name - Path to the font file.

virtual int setSkin (const char * name) const =0

Changes the skin used in the Gui.

Arguments

  • const char * name - Path to the skin directory (a rc file and textures).

virtual int setResource (const char * name) const =0

Changes the resource file skin used in the system Gui.

Arguments

  • const char * name - Path to the rc file.

virtual int clearTexture (const char * name) const =0

Clears Gui texture.

Arguments

  • const char * name - Texture name.

Return value

Returns 1 on success, or 0 if an error occurred.

virtual vec4 parseColor (const char * str) const =0

Parses color string.

Arguments

  • const char * str - Color string.

Return value

Parsed color.

virtual void clearDictionaries () const =0

Clear all dictionaries.

virtual int addDictionary (const char * name, const char * language) const =0

Adds a dictionary.

Arguments

  • const char * name - Path to the dictionary file.
  • const char * language - Dictionary language name.

Return value

Returns 1 on success, or 0 if an error occurred.

virtual int saveDictionary (const char * name, const char * language) const =0

Saves a dictionary.

Arguments

  • const char * name - Path to the dictionary file.
  • const char * language - Dictionary language name.

Return value

Returns 1 on success, or 0 if an error occurred.

virtual const char * translate (const char * str) const =0

Translates string using dictionary.

Arguments

  • const char * str - String to translate.

Return value

Translated string.

Unigine::Gui::anonymous_6 Enumeration

SHOW = 0
HIDE
FOCUS_IN
FOCUS_OUT
CHANGED
CLICKED
DOUBLE_CLICKED
PRESSED
RELEASED
KEY_PRESSED
ENTER
LEAVE
DRAG_DROP
NUM_CALLBACKS

Unigine::Gui::anonymous_7 Enumeration

VERTICAL = 0
HORIZONTAL

Unigine::Gui::anonymous_8 Enumeration

VALIDATOR_ANY = 0
VALIDATOR_INT
VALIDATOR_UINT
VALIDATOR_FLOAT
VALIDATOR_ASCII

Unigine::Gui::anonymous_9 Enumeration

ATTACH_LOG10 = 1 << 0
ATTACH_MIN_EXPAND = 1 << 1
ATTACH_MAX_EXPAND = 1 << 2

Unigine::Gui::anonymous_10 Enumeration

ALIGN_CENTER = 1 << 0
ALIGN_LEFT = 1 << 1
ALIGN_RIGHT = 1 << 2
ALIGN_TOP = 1 << 3
ALIGN_BOTTOM = 1 << 4
ALIGN_EXPAND = 1 << 5
ALIGN_OVERLAP = 1 << 6
ALIGN_BACKGROUND = 1 << 7
ALIGN_FIXED = 1 << 8

Unigine::Gui::anonymous_11 Enumeration

CURSOR_NONE = 0
CURSOR_ARROW
CURSOR_NA
CURSOR_DND
CURSOR_WIDTH
CURSOR_HEIGHT
CURSOR_NESW
CURSOR_NWSE
CURSOR_MOVE
CURSOR_ROTATE
CURSOR_SCALE
NUM_CURSORS
Last update: 2017-07-03