TextureBase:SetAtlas

From Warcraft Wiki
Jump to navigation Jump to search

Sets the texture to an atlas.

TextureBase:SetAtlas(atlas [, useAtlasSize, filterMode, resetTexCoords])

Arguments

atlas
string : textureAtlas
useAtlasSize
boolean? = false - True if the size of the texture should be changed to match the dimensions of the atlas.
filterMode
string? : FilterModeLINEAR, TRILINEAR, NEAREST - Texture filtering mode to use, one of: LINEAR (default; bilinear filtering), TRILINEAR (also sampling mipmaps), or NEAREST (nearest-neighbor filtering).
resetTexCoords
boolean?

Details

  • A texture atlas is technically an image containing multiple smaller images, but the wiki simply refers to those smaller images as atlases.
  • The behavior of this function may be replicated by calling SetTexture and SetTexCoord.

Example

Shows the Paladin class trial icon on the screen

-- create texture
local f = CreateFrame("Frame")
f:SetSize(1, 1)
f:SetPoint("CENTER")
f.tex = f:CreateTexture()
f.tex:SetPoint("CENTER")

-- set the atlas and use atlas size
f.tex:SetAtlas("ClassTrial-Paladin-Ring", true)
-- which is equivalent to setting a texture, size and tex coords
f.tex:SetTexture("Interface/Glues/AccountUpgrade/ClassTrialThanksFrame")
f.tex:SetSize(188, 188)
f.tex:SetTexCoord(0.186523, 0.370117, 0.339844, 0.523438)

This can be referenced in Helix/AtlasInfo.lua

["Interface/Glues/AccountUpgrade/ClassTrialThanksFrame"]={
	["ClassTrial-Paladin-Ring"]={188, 188, 0.186523, 0.370117, 0.339844, 0.523438, false, false},

Patch changes

Warlords of Draenor Patch 6.0.2 (2014-10-14): Added.