|Go to Page...|
|Updated:||11-11-13 01:22 AM|
|Created:||11-11-13 01:22 AM|
This is a nifty little library I wrote for myself a while ago, to tackle a problem that's fairly common but somewhat tedious. The problem being: what happens when you have more frame regions (textures and/or fontstrings) than there are draw layers available, but you want to ensure they're layered properly?
Normally, the solution is to create a container frame for some of those files, and that works well. But doing this often is tedious, and adds weight to your code reducing the readability. So I wrote Five, which will automatically manage an infinite amount of containers, so layering regions properly is as simple as calling the new API function: region:SetZLevel(n).
Five does not use LibStub, but it works in much the same way. Include a copy of libFive-1.0.lua in your addon (and load it via your .toc file), and then fetch a working reference to the library from _G:
--libs local five = _G['libFive-1.0']
-- local myFrame = CreateFrame('Frame','MYFrame',UIParent) -- old local myFrame = five:CreateFrame('Frame','MYFrame',UIParent) -- new
-- local myFrame = CreateFrame('Frame','MYFrame',UIParent) -- old local myFrame = five('Frame','MYFrame',UIParent) -- new
local tex1 = myFrame:CreateTexture(nil,'OVERLAY') tex1:SetZLevel(1) local tex2 = myFrame:CreateTexture(nil,'BACKGROUND') tex2:SetZLevel(2) -- tex2 will appear layered above tex1
r1:SetZLevel(1) r2:SetZLevel(99) r3:SetZLevel(254) -- ...