API:ButtonSetTexture
From RoR Wiki
UI Lua API · Button functions
Version: WAR 1.4.8
Sets the texture a Button draws in one of its states.
ButtonSetTexture(buttonName, state, textureName, x, y)
Arguments
- buttonName
string– Name of a Button window.- state
number– The button state, aButton.ButtonStatevalue (see ButtonSetTextColor).- textureName
string– Name of the texture.""removes the texture for that state.- x, y
number– Pixel position in the texture of the top-left corner of the area to show.
Returns
Nothing.
Details
- The previous texture for that state is always removed first. If no texture is found under
textureName, the state is left without a texture and no error is raised. stateis not range-checked. Use only theButton.ButtonStatevalues.
Errors
Error in function call 'ButtonSetTexture': Window %s does not existError in function call 'ButtonSetTexture': Window %s is not a Button
Example
Changing an ability button's highlight frame to match its shape, and clearing it, from ea_abilitieswindow/source/abilitieswindow.lua:
ButtonSetTexture (SystemData.ActiveWindow.name, Button.ButtonState.HIGHLIGHTED, "EA_SquareFrame_Highlight", 0, 0) ... ButtonSetTexture (SystemData.ActiveWindow.name, Button.ButtonState.HIGHLIGHTED, "", 0, 0)
