View Single Post
09-30-08, 06:17 AM   #1
Kellen
A Deviate Faerie Dragon
Join Date: Mar 2008
Posts: 18
oUF CastBar Spark

I recently took the plunge and started playing with oUF in the hopes of replacing Pitbull/Quartz/etc. I've used oUF_Caelian as an example to work from.

My question centers around adding a spark to the casting bar a la the Blizzard or Pitbull versions. Looking in oUF/elements/castbar.lua, I can see that there is code to support this, should a Spark frame exist. How do I add this frame properly? How I've added it clearly isn't correct.

Thus far, I've modified what Kyron has for casting bar initialization, but I'm sure I'm missing something trivial.

(I'll post all of the code, though I think only the last bit is relevant)

Code:
self.Castbar = CreateFrame('StatusBar', nil, self)
self.Castbar:SetBackdrop({
  bgFile = 'Interface\\Tooltips\\UI-Tooltip-Background',
  edgeFile = 'Interface\\AddOns\\oUF_Kellen\\rothBorder',
  edgeSize = 8,
  insets = {top = -5, left = -5, bottom = -5, right = -5}
})
self.Castbar:SetBackdropColor(0,0,0,.5)
self.Castbar:SetWidth(285)
self.Castbar:SetHeight(24)
self.Castbar:SetStatusBarTexture(texturebar)
self.Castbar:SetStatusBarColor(1,0.5,0.1,1)
      
if (unit == 'player') then
  self.Castbar:SetPoint('BOTTOM', UIParent, 'BOTTOM', 0, 150)
else
  self.Castbar:SetPoint('BOTTOM', UIParent, 'BOTTOM', 0, 185)
end
      
self.Castbar.SafeZone = self.Castbar:CreateTexture(nil,'ARTWORK')
self.Castbar.SafeZone:SetTexture(texturebar)
self.Castbar.SafeZone:SetVertexColor(1,0,0,1)
self.Castbar.SafeZone:SetPoint('TOPRIGHT')
self.Castbar.SafeZone:SetPoint('BOTTOMRIGHT')
      
self.Castbar.bg = self.Castbar:CreateTexture(nil, 'BORDER')
self.Castbar.bg:SetPoint("TOPLEFT", self.Castbar, "TOPLEFT", -1, 1)
self.Castbar.bg:SetPoint("BOTTOMRIGHT", self.Castbar, "BOTTOMRIGHT", 1, -1)
self.Castbar.bg:SetTexture(texturebar)
self.Castbar.bg:SetVertexColor(0,0,0,.5)
      
self.Castbar.Text = SetFontString(self.Castbar, 14, '')
self.Castbar.Text:SetPoint('LEFT', self.Castbar, 5, 0)
self.Castbar.Text:SetWidth(250)
self.Castbar.Text:SetTextColor(1,1,1)
      
self.Castbar.Time = SetFontString(self.Castbar, 14, '')
self.Castbar.Time:SetPoint('RIGHT', self.Castbar, -5, 0)
self.Castbar.Time:SetTextColor(1,1,1)
self.Castbar.Time:SetJustifyH('RIGHT')
      
self.Castbar.Spark = self.Castbar:CreateTexture(nil, 'ARTWORK')
self.Castbar.Spark:SetTexture('Interface\\CastingBar\\UI-CastingBar-Spark')
self.Castbar.Spark:SetPoint('LEFT', self.Castbar, 'LEFT', 0, 0)
self.Castbar.Spark:SetHeight(24)
self.Castbar.Spark:SetWidth(10)
  Reply With Quote