View Single Post
11-13-10, 03:51 PM   #10
Zagrei
A Cobalt Mageweaver
 
Zagrei's Avatar
AddOn Compiler - Click to view compilations
Join Date: Nov 2009
Posts: 246
Originally Posted by iradex View Post
Would be awsome! I can do this SetBackdrop to other things, like nameplates, bag addons, etc.. ?
Pretty much. I use it for sThreatMeter, Headline, StUF, TinyDPS, iMinimap, my personal ExpBar addon, I made a backdrop for my actionbars, and probably a few other places as well.

FOR STUF:
Around line 200 of 'bars.lua', change this:
Code:
if db.fade and not f.barfade then
f.barfade = f:CreateTexture(nil, "BORDER")
end

-- five second rule mana tick
to this:
Code:
if db.fade and not f.barfade then
f.barfade = f:CreateTexture(nil, "BORDER")
end

local bg = CreateFrame("Frame", nil, f)
bg:SetBackdrop({
        bgFile = 'Interface\\ChatFrame\\ChatFrameBackground',
	edgeFile = 'Interface\\ChatFrame\\ChatFrameBackground',
	edgeSize = 1,
})
bg:SetBackdropColor(0, 0, 0, .4)
bg:SetBackdropBorderColor(0, 0, 0)
bg:SetFrameLevel(0)
bg:SetPoint("TOPLEFT", f, -1, 1)
bg:SetPoint("BOTTOMRIGHT", f, 1, -1)

-- five second rule mana tick

The ONLY difference, obviously, is the SetBackdrop call. What you do is this:

-You find the frame you want to put the backdrop on
-Find it's name (in this case, 'f')
-Insert the frame's name into the highlighted areas
-/reloadui ingame, and see if it worked! (LOL)

To clarify, the following code is what you use in all of the addons. Don't forget to change the frame names to match the frame you want to attach it to!

Code:
local bg = CreateFrame("Frame", nil, f)
bg:SetBackdrop({
        bgFile = 'Interface\\ChatFrame\\ChatFrameBackground',
	edgeFile = 'Interface\\ChatFrame\\ChatFrameBackground',
	edgeSize = 1,
})
bg:SetBackdropColor(0, 0, 0, .4)
bg:SetBackdropBorderColor(0, 0, 0)
bg:SetFrameLevel(0)
bg:SetPoint("TOPLEFT", f, -1, 1)
bg:SetPoint("BOTTOMRIGHT", f, 1, -1)
You may not always try the right frame the first time, but that just takes trial and error. You'll get the hang of it quickly Lemme know if you need more help/explanation!
__________________

Last edited by Zagrei : 11-13-10 at 03:54 PM.
  Reply With Quote