API:DynamicImageSetTexture
From RoR Wiki
UI Lua API · DynamicImage functions
Version: WAR 1.4.8
Sets the texture a DynamicImage shows and where in that texture to start.
DynamicImageSetTexture(imageName, textureName, x, y)
Arguments
- imageName
string– Name of a DynamicImage window.- textureName
string– Name of the texture.- x, y
number– Pixel position in the texture of the top-left corner of the area to show. Fractions are dropped.
Returns
Nothing.
Details
- If the texture name,
xandyare all the same as before, nothing happens. - The size of the area shown is set with DynamicImageSetTextureDimensions. If that has not been set (or one of its values is 0), the area is the window's size divided by the texture scale (see DynamicImageSetTextureScale).
- A comment in the stock UI says this function does not work correctly while a texture slice is assigned; the stock code clears the slice first with
DynamicImageSetTextureSlice( name, "" ).
Errors
Error in function call 'DynamicImageSetTexture': Window %s does not existError in function call 'DynamicImageSetTexture': Window %s is not a DynamicImage
Example
From easystem_glyphdisplay/source/glyphdisplay.lua:
DynamicImageSetTexture( glyphWindowName, glyphData.textureName, 64, 64 )
Switching a map icon from a slice to texture coordinates, from easystem_tooltips/source/maptooltips.lua:
textureX, textureY, sizeX, sizeY = GetMapIconData( ptData.mapIcon ) -- Clear the slice on the dynamic image. DynamicImageSetTexture will not work -- correctly if a slice is assigned. DynamicImageSetTextureSlice( iconWindow, "" ) DynamicImageSetTexture( iconWindow, "map_markers01", textureX, textureY )
