WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF CastBar Spark (https://www.wowinterface.com/forums/showthread.php?t=18348)

Kellen 09-30-08 06:17 AM

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)


duhwhat 10-01-08 12:25 PM

is this a GCD spark like from quartz?

Kellen 10-01-08 12:41 PM

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.

Kellen 10-01-08 05:33 PM

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.


All times are GMT -6. The time now is 11:24 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI