View Single Post
01-17-10, 07:51 PM   #18
Toran
A Nerdscale Dorkin
 
Toran's Avatar
Premium Member
Join Date: May 2006
Posts: 143
Thanks Zork. I used portions of your code and came up with the following, which does the trick...

For anyone else wondering, this part goes in the beginning, pre-layout:

Code:
local function kiss_set_me_a_backdrop(f)
    f:SetBackdrop( { 
      bgFile = bartex, 
      edgeFile = "", tile = false, tileSize = 0, edgeSize = 32, 
      insets = { left = -2, right = -2, top = -2, bottom = -2 }
    })
    f:SetBackdropColor(0,0,0,1)
  end


local function updateCPoints(self, event, unit)
	if unit == PlayerFrame.unit and unit ~= self.CPoints.unit then
		self.CPoints.unit = unit
	end
end
This goes in the "target" section of the layout:

Code:
self.CPoints = {}
		self.CPoints.unit = PlayerFrame.unit
		for i = 1, 5 do
			self.CPoints[i] = CreateFrame("Frame", nil, self.Health)
			self.CPoints[i]:SetHeight(6)
			self.CPoints[i]:SetWidth(39)
			kiss_set_me_a_backdrop(self.CPoints[i])
			self.CPoints[i].bg = self.CPoints[i]:CreateTexture(nil, "LOW")
			self.CPoints[i].bg:SetTexture(bartex)
			self.CPoints[i].bg:SetAllPoints(self.CPoints[i])
			if i == 1 then
				self.CPoints[i]:SetPoint("LEFT", self.Health, "LEFT", 0, 17)
			else
				self.CPoints[i]:SetPoint("LEFT", self.CPoints[i-1], "RIGHT", 2, 0)
			end
		end

		self.CPoints[1].bg:SetVertexColor(1,1,0)
		self.CPoints[2].bg:SetVertexColor(1,0.75,0)
		self.CPoints[3].bg:SetVertexColor(1,0.5,0)
		self.CPoints[4].bg:SetVertexColor(1,0.25,0)
		self.CPoints[5].bg:SetVertexColor(1,0,0)
		self:RegisterEvent("UNIT_COMBO_POINTS", updateCPoints)
Good stuff. Learned a ton, but still a noob. Thanks all. Now to implement the runes...
  Reply With Quote