View Single Post
09-08-12, 02:17 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Erm, I have no idea why you're defining that ComboDisplay function and using it as an element Override, when it's functionally identical to oUF's standard combo point update function, but contains a lot of unnecessary redundancy. You set the alpha to 15% and then hide the frame, instead of just hiding it, for example. Try getting rid of the Override and see if it works then.

I also don't understand what you're trying to do with the bars.FrameBackdrop section at the end of the block you posted. It's just an extra frame, attached to the bars frame, with no visible anything, since you call SetBackdrop on bars instead of bars.FrameBackdrop, and anyway you're setting the same backdrop that you already set on bars, so even if you did set it on the bars.FrameBackdrop frame, you'd only see 1 pixel of it around the edges since the frames are stacked on top of each other. I'd suggest just getting rid of the whole thing. If you want a 1px border on the bars frame, just change its backdrop to include a 1px border, eg:

Lua Code:
  1. local backdrop = {
  2.     bgFile = "Interface\\BUTTONS\\WHITE8X8", tile = true, tileSize = 8,
  3.     edgeFIle = "Interface\\BUTTONS\\WHITE8X8", edgeSize = 1,
  4.     insets = { left = 1, right = 1, top = 1, bottom = 1 },
  5. }

Finally, your genCPoints function parents bars to self, but anchors it to oUF_Player. If multiple frames call genCpoints, you'll end up with multiple objects piled on top of each other. I'd also suggest combo points be attached to the target frame, rather than the player frame. Not only does that give you more room on the player frame for class powers, but combo points also logically belong on the target, at least for druids, who can have different numbers of combo points on different targets at the same time.

Try this:
Lua Code:
  1. lib.genCPoints = function(self)
  2.     local bars = CreateFrame("Frame", nil, self)
  3.     bars:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, 7)
  4.         -- ^^^ Attach to self, and then just call this function from the
  5.         --     frame you actually want it attached to, probably target.
  6.     bars:SetWidth(210)
  7.     bars:SetHeight(2)
  8.     bars:SetBackdrop(backdrop)
  9.     bars:SetBackdropBorderColor(0,0,0,0)
  10.     bars:SetBackdropColor(0,0,0,0)
  11.  
  12.     for i = 1, 5 do
  13.         bars[i] = CreateFrame("StatusBar", nil, bars)
  14.             -- ^^^ No reason to give this a global name.
  15.         bars[i]:SetWidth(41.2) -- (210 - 4) / 5
  16.             -- ^^^ No need to do the math on the fly since it isn't dynamic.
  17.         bars[i]:SetHeight(20)
  18.         bars[i]:SetStatusBarTexture(config.statusbar_texture)
  19.         bars[i]:GetStatusBarTexture():SetHorizTile(false)
  20.         if i == 1 then
  21.             bars[i]:SetPoint("LEFT", bars)
  22.         else
  23.             bars[i]:SetPoint("LEFT", bars[i-1], "RIGHT", 1, 0)
  24.         end
  25.     end
  26.  
  27.     bars[1]:SetStatusBarColor(0.69, 0.31, 0.31)
  28.     bars[2]:SetStatusBarColor(0.69, 0.31, 0.31)
  29.     bars[3]:SetStatusBarColor(0.65, 0.63, 0.35)
  30.     bars[4]:SetStatusBarColor(0.65, 0.63, 0.35)
  31.     bars[5]:SetStatusBarColor(0.33, 0.59, 0.33)
  32.  
  33.     self.CPoints = bars
  34. end
__________________
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.

Last edited by Phanx : 09-08-12 at 02:19 AM.
  Reply With Quote