Thread Tools Display Modes
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
10-01-08, 12:25 PM   #2
duhwhat
A Wyrmkin Dreamwalker
Join Date: Aug 2008
Posts: 51
is this a GCD spark like from quartz?
  Reply With Quote
10-01-08, 12:41 PM   #3
Kellen
A Deviate Faerie Dragon
Join Date: Mar 2008
Posts: 18
I'm not that ambitious quite yet. It's just the visual element at the leading end of the cast bar. I believe the default Blizzard castbar has a similar element.
  Reply With Quote
10-01-08, 05:33 PM   #4
Kellen
A Deviate Faerie Dragon
Join Date: Mar 2008
Posts: 18
And just like that, an oUF library update solves it all!

Now I can add the following code (to what I had before) to make it 'just work':

Code:
self.Castbar.Spark = self.Castbar:CreateTexture(nil, 'OVERLAY')
self.Castbar.Spark:SetHeight(50)
self.Castbar.Spark:SetWidth(25)
self.Castbar.Spark:SetBlendMode('ADD')
'OVERLAY' ensures it's on top of the castbar. Width and height can be played with to suit your needs. The blend mode applies the texture's alpha channels, so that you don't have a big black block on your cast bar.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF CastBar Spark


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off