View Single Post
03-19-18, 05:22 AM   #2
jukx
A Murloc Raider
 
jukx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 7
1. and 2. definitely don't seem to be the way to go. You'd have to recalculate the absorb bar width every time the health amount changes i.e. at each regen tick.

Your 3rd option comes close to how oUF suggests doing it which also looks sensible to me.

Lua Code:
  1. -- Position and size
  2.     local myBar = CreateFrame('StatusBar', nil, self.Health)
  3.     myBar:SetPoint('TOP')
  4.     myBar:SetPoint('BOTTOM')
  5.     myBar:SetPoint('LEFT', self.Health:GetStatusBarTexture(), 'RIGHT')
  6.     myBar:SetWidth(200)
  7.     local otherBar = CreateFrame('StatusBar', nil, self.Health)
  8.     otherBar:SetPoint('TOP')
  9.     otherBar:SetPoint('BOTTOM')
  10.     otherBar:SetPoint('LEFT', myBar:GetStatusBarTexture(), 'RIGHT')
  11.     otherBar:SetWidth(200)
  12.     local absorbBar = CreateFrame('StatusBar', nil, self.Health)
  13.     absorbBar:SetPoint('TOP')
  14.     absorbBar:SetPoint('BOTTOM')
  15.     absorbBar:SetPoint('LEFT', otherBar:GetStatusBarTexture(), 'RIGHT')
  16.     absorbBar:SetWidth(200)
  17.     local healAbsorbBar = CreateFrame('StatusBar', nil, self.Health)
  18.     healAbsorbBar:SetPoint('TOP')
  19.     healAbsorbBar:SetPoint('BOTTOM')
  20.     healAbsorbBar:SetPoint('RIGHT', self.Health:GetStatusBarTexture())
  21.     healAbsorbBar:SetWidth(200)
  22.     healAbsorbBar:SetReverseFill(true)

Although to save some calculations please do use a 100% width texture below the whole bar for the deficit.

(because I have to hide unused textures and rearrange their anchors all the time)
Well you'd only have to set their anchors once, WoW does the moving behind the scenes (in an optimized fashion, one would hope). Also, aren't textures with width 0 (or empty statusbars) invisible by default?
  Reply With Quote