Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------------------
- --- || DYNAMIC BORDER TEMPLATE || -----------------
- ---------------------------------------------------
- local frames = {
- ["TOPLEFT"] = {
- w = 64,
- h = 64,
- x = -9,
- y = 9
- },
- ["TOPRIGHT"] = {
- w = 64,
- h = 64,
- x = 9,
- y = 9
- },
- ["BOTTOMLEFT"] = {
- w = 64,
- h = 64,
- x = -9,
- y = -9
- },
- ["BOTTOMRIGHT"] = {
- w = 64,
- h = 64,
- x = 9,
- y = -9
- },
- ["TOP"] = {
- h = 64,
- a = {
- ["TOPLEFT"] = {"LEFT","RIGHT"},
- ["TOPRIGHT"] = {"RIGHT","LEFT"}
- }
- },
- ["BOTTOM"] = {
- h = 64,
- a = {
- ["BOTTOMLEFT"] = {"LEFT","RIGHT"},
- ["BOTTOMRIGHT"] = {"RIGHT","LEFT"}
- }
- },
- ["LEFT"] = {
- w = 64,
- a = {
- ["TOPLEFT"] = {"TOP","BOTTOM"},
- ["BOTTOMLEFT"] = {"BOTTOM","TOP"}
- }
- },
- ["RIGHT"] = {
- w = 64,
- a = {
- ["TOPRIGHT"] = {"TOP","BOTTOM"},
- ["BOTTOMRIGHT"] = {"BOTTOM","TOP"}
- }
- }
- }
- local function DynamicBorderTemplate(name, parent, strata, flevel, ...)
- local scale = ...
- for k,v in pairs(frames) do
- local f = CreateFrame("FRAME",name..k,parent)
- -- Anchoring
- if v.a then -- TOP,BOTTOM,LEFT,RIGHT SetPoint frame referencing
- for c,g in pairs(v.a) do
- f:SetPoint(g[1],_G[name..c],g[2],0,0) -- References the previous frames dynamically
- end
- else
- f:SetPoint(k,parent,v.x,v.y)
- end
- -- Frame Parameters
- if v.w then
- f:SetWidth(v.w)
- end
- if v.h then
- f:SetHeight(v.h)
- end
- if scale then
- f:SetScale(scale)
- end
- f:SetStrata(strata)
- f:SetFrameLevel(flevel)
- -- Textures
- f.tex = f:CreateTexture(nil, strata)
- f.tex:SetParent(f)
- f.tex:SetAllPoints(f)
- f.tex:SetTexture(cfg["DYNAMIC_BORDER_"..k]) -- Note that this is an easier way to reference your textures if you rewrite your config variable names
- return f -- Line may not be neccessary
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement