View Single Post
08-14-14, 08:24 PM   #18
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Actually, it occurred to me that you don't need to do any SetPoint work in the update routine -- you only need to set the point of each font string once, when it's created.

Code:
local lines = setmetatable({}, { __index = function(t, i)
    local line = UIParent:CreateFontString(nil, "OVERLAY", "GameFontNormal")
    if i > 1 then
        line:SetPoint("BOTTOM", lines[i-1], "TOP")
    else
        line:SetPoint("BOTTOM", UIParent, "CENTER")
    end
    -- do other stuff here, add shadow, outline, custom font, whatever
    t[i] = line
    return line
end })
All you need to do in the update routine is either SetText+Show, or Hide.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote