View Single Post
07-12-14, 08:03 AM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
If you just want a simple solid line border, you can just set the backdrop on the frame itself:

Code:
    frame:SetBackdrop({
        bgFile = "Interface\\AddOns\\oUF_Kygo\\Media\\backdrop", tile = false,
        edgeFile = "Interface\\AddOns\\oUF_Kygo\\Media\\backdrop_edge", edgeSize = 5,
        insets = { left = 1, right = 1 , top = 1, bottom = 1 }
    })
    frame:SetBackdropColor(0, 0, 0, .1)
    frame:SetBackdropBorderColor(0, 0, 0, 1)
However, if you want to use a separate object, then:

1) Attach it to the unit frame, not to the health bar or some other child frame, since it's a backdrop for the whole frame, not a backdrop just for the health bar (which already has a backdrop in the code Rainrider posted).

2) Rather than setting a width and height, just set multiple points so it will automatically cover the whole frame:

Code:
local frameBG = frame:CreateTexture(nil, "BACKGROUND")
frameBG:SetPoint("BOTTOMLEFT", -5, -5)
frameBG:SetPoint("TOPRIGHT", 5, 5)
frameBG:SetTexture(0, 0, 0, 1)
This will create a texture that extends 5px outside of the frame on all sides, and no matter how you resize the frame, the texture will be resized automatically so it still extends 5px outside the frame.

===============================================================

How exactly do you want to customize the health bar color? Depending on your answer, oUF may be able to do it for you automatically, or you might have to do it yourself. Either way, you don't need to use SetStatusBarTexture to change the color. That just tells the bar which texture file to use. To change the color, you only need to use SetStatusBarColor (note the capital B in StatusBar, which is not the same as the Statusbar you wrote, since Lua is case-sensitive).

Also, neither of those functions returns a value -- they're "do stuff" functions, not "get information" functions. What information are you trying to get, and what do you want to do with it?

===============================================================

Honestly I'd strongly recommend against trying to add any configuration at this point, since it just makes your code more complex. Right now you're learning how to bake a cake. Trying to make this your first time in the kitchen isn't really advisable.
__________________
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