texture_get_uvs


Description

This function returns a 1D array with 4 elements representing the UV coordinates for the image on the texture page, filling in the array with the following values:

This value can then be used in other draw functions, particularly in general 3D and some of the 2D primitive functions, as well as the Shader functions. If you need the UVS for a sprite then you can use the sprite_get_uvs and for a font, font_get_uvs.


Syntax:

texture_get_uvs(texid)


Arguments:

Argument Description
texid The image asset to get the texture from


Returns:

1D Array (4 elements)


Example:

var tex = texture_get_uvs(surf_back);
tex_left = tex[0];
tex_top = tex[1];
tex_right = tex[2];
tex_left = tex[3];

The above code will store the UV coordinates for the given surface texture in a local array and then assign the values to instance variables.


Back: Textures
Next: texture_set_stage
© Copyright YoYo Games Ltd. 2018 All Rights Reserved