This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

WidgetSprite Class

Interface for widget sprite handling. See also UnigineScript analog.

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

WidgetSprite Class

Members


WidgetSprite (const Ptr<Gui> & gui, const char * name = 0)

Constructor. Creates a sprite with a given texture.

Arguments

  • const Ptr<Gui> & gui - GUI, to which the new sprite will belong.
  • const char * name - Path to the texture. This is an optional parameter.

int getLayerWrapRepeat (int layer)

Returns a value indicating if texture tiling is enabled for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Returns 1 if texture tiling is enabled; 0 if disabled.

Math::vec4 getColor ()

Returns the current color set for the first (bottom) layer of the sprite.

Return value

Modulation color.

Ptr<WidgetSprite> getWidgetSprite ()

Return value

Math::vec4 getLayerTexCoord (int layer)

Returns the current coordinates of the texture set for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Texture coordinates. The first pair of coordinates (x and y) is for the upper left corner, the second pair (z and w) is for the lower right corner.

void setLayerBlendFunc (int layer, int src, int dest)

Sets blending coefficients for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • int src - Blending mode for the source color (one of the BLEND_*).
  • int dest - Blending mode for the destination color (one of the BLEND_*.

Math::mat4 getLayerTransform (int layer)

Returns the current transformation matrix set for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Transformation matrix.

int getBlendSrcFunc ()

Returns the blending mode of the source screen buffer colour set for the first (bottom) layer of the sprite.

Return value

Blending mode (one of the BLEND_*).

int getBufferMask ()

Returns the current channel mask for the whole sprite.

Return value

Current channel mask (one of the BUFFER_*).

void setTransform (const Math::mat4 & transform)

Sets a transformation matrix for the first (bottom) layer of the sprite. This layer always exists in the sprite.

Arguments

  • const Math::mat4 & transform - Transformation matrix.

void setLayerTransform (int layer, const Math::mat4 & transform)

Sets a transformation matrix for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • const Math::mat4 & transform - Transformation matrix.

void setLayerTexCoord (int layer, const Math::vec4 & texcoord)

Sets the coordinates of the texture for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • const Math::vec4 & texcoord - Texture coordinates. The first pair of coordinates (x and y) is for the upper left corner, the second pair (z and w) is for the lower right corner.

void setLayerEnabled (int layer, int enabled)

Sets a value indicating if the layer is enabled for rendering.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • int enabled - 1 to enable the layer; 0 to disable it.

Math::mat4 getTransform ()

Returns the current transformation matrix set for the first (bottom) layer of the sprite.

Return value

Transformation matrix.

void getLayerImage (int layer, const Ptr<Image> & image)

Returns the current image set for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • const Ptr<Image> & image - Current image.

void setColor (const Math::vec4 & color)

Sets a color for the first (bottom) layer of the sprite. This layer always exists in the sprite.

Arguments

  • const Math::vec4 & color - Modulation color.

int getLayerWidth (int layer)

Returns the current width of the layer (regardless of layer transformation).

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Width of the layer in units.

Ptr<Texture> getRender ()

Returns the pointer to the texture that is currently set for the first (bottom) layer of the sprite.

Return value

Pointer to the texture.

Math::vec4 getTexCoord ()

Returns the current coordinates of the texture set for the first (bottom) layer of the sprite.

Return value

Texture coordinates. The first pair of coordinates (x and y) is for the upper left corner, the second pair (z and w) is for the lower right corner.

void setLayerColor (int layer, const Math::vec4 & color)

Sets a color for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • const Math::vec4 & color - Modulation color.

Ptr<Texture> getLayerRender (int layer)

Returns the current texture set for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Pointer to the texture.

int isLayerEnabled (int layer)

Returns a value indicating if the layer is enabled for rendering.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Returns 1 if the layer is enabled; 0 if disabled.

int getWrapRepeat ()

Returns a value indicating if texture tiling is enabled for the first (bottom) layer of the sprite.

Return value

Returns 1 if texture tiling is enabled; 0 if disabled.

void setLayerTexture (int layer, const char * name)

Sets a texture for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • const char * name - Path to the texture.

int getLayerHeight (int layer)

Returns the current width of the layer (regardless of layer transformation).

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Width of the layer in units.

void getImage (const Ptr<Image> & image)

Returns the loaded into memory image that is currently set for the first (bottom) layer of the sprite.

Arguments

  • const Ptr<Image> & image - Pointer to the image.

int type ()

WidgetSprite type.

Return value

WidgetSprite type identifier.

void setTexture (const char * texture)

Sets a texture from a file for the first (bottom) layer of the sprite. This layer always exists in the sprite.

Arguments

  • const char * texture - Path to the texture.

int addLayer ()

Adds an empty layer with default properties to the sprite.

Return value

Number of the added layer.

void setBufferMask (int mask)

Sets a channel mask for the whole sprite. If a mask for a channel exists, one can draw in this channel.

Arguments

  • int mask - Channel mask (one of the BUFFER_*).

Math::vec4 getLayerColor (int layer)

Returns the current color set for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers..

Return value

Modulation color.

void setLayerWrapRepeat (int layer, int repeat)

Sets texture tiling for a given layer of the sprite. To see tiling in effect, you need to transform sprite texture coordinates via setLayerTexCoord().

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • int repeat - Positive number to enable texture tiling; 0 to disable it.

void setLayerRender (int layer, const Ptr<Texture> & texture, int flipped = 0)

Sets a texture for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • const Ptr<Texture> & texture - Pointer to the texture.
  • int flipped - Flipped flag.

const char * getLayerTexture (int layer)

Returns the current texture set for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Path to the texture.

void setTexCoord (const Math::vec4 & coord)

Sets the coordinates of the texture for the first (bottom) layer of the sprite. This layer always exists in the sprite.

Arguments

  • const Math::vec4 & coord - Texture coordinates. The first pair of coordinates (x and y) is for the upper left corner, the second pair (z and w) is for the lower right corner.

void removeLayer (int layer)

Removes a given layer from the sprite.

Arguments

  • int layer - Layer number in range from 1 to the total number of sprite layers.

int getNumLayers ()

Returns the total number of layers in the sprite.

Return value

Number of layers.

void setLayerImage (int layer, const Ptr<Image> & image, int dynamic = 0)

Sets an image for a given layer of the sprite. An additional flag can be set in case the sprite image is going to be updated often or even each frame (for optimized memory management).

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • const Ptr<Image> & image - Image to set.
  • int dynamic - Positive number if the image will be updated each frame; otherwise, 0.

void setRender (const Ptr<Texture> & texture, int flipped = 0)

Sets a texture to be rendered for the first (bottom) layer of the sprite.

Arguments

  • const Ptr<Texture> & texture - Pointer to the texture.
  • int flipped - Flipped flag.

int getLayerBlendDestFunc (int layer)

Returns the blending mode of the destination widget colour set for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Blending mode (one of the BLEND_*).

void setLayerBufferMask (int layer, int mask)

Sets a channel mask for a given layer of the sprite. If a mask for a channel exists, one can draw in this channel.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.
  • int mask - Channel mask. The default is BUFFER_ALL.

Ptr<WidgetSprite> create (const Ptr<Widget> & widget)

WidgetSprite constructor.

Arguments

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

Return value

void setBlendFunc (int src, int dest)

Sets blending coefficients for the first (bottom) layer of the sprite. This layer always exists in the sprite.

Arguments

  • int src - Blending mode for the source screen buffer color (one of the BLEND_*).
  • int dest - Blending mode for the destination widget color (one of the BLEND_*).

int getLayerBlendSrcFunc (int layer)

Returns the blending mode of the source screen buffer colour set for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Blending mode (one of the BLEND_*).

int getBlendDestFunc ()

Returns the blending mode of the destination widget colour set for the first (bottom) layer of the sprite.

Return value

Blending mode (one of the BLEND_*).

void setWrapRepeat (int repeat)

Sets texture tiling for the first (bottom) layer of the sprite. This layer always exists in the sprite. The default is 0 (no tiling). To see tiling in effect, you need to transform sprite texture coordinates via setTexCoord().

Arguments

  • int repeat - 1 to enable texture tiling; 0 to disable it.

void setImage (const Ptr<Image> & image, int dynamic = 0)

Sets a loaded into memory image for the first (bottom) layer of the sprite. This layer always exists in the sprite. An additional flag can be set in case the sprite image is going to be updated often or even each frame (for optimized memory management).

Arguments

  • const Ptr<Image> & image - Pointer to the image.
  • int dynamic - Positive number if the image will be updated each frame; otherwise, 0.

const char * getTexture ()

Returns the texture from a file that is currently set for the first (bottom) layer of the sprite.

Return value

Path to the texture.

int getLayerBufferMask (int layer)

Returns the current channel mask set for a given layer of the sprite.

Arguments

  • int layer - Layer number in range from 0 to the total number of sprite layers.

Return value

Channel mask. The default is BUFFER_ALL.
Last update: 03.07.2017
Build: ()