Originally Posted by Folji
Decided to try and test this, see how it'd go.
Lua Code:
lib.CreateHealth = function(frame,frametype,width,height,point,x,y) local hp = CreateFrame('StatusBar',nil,frame) hp:SetSize(width,height) hp:SetPoint(point,frame,x,y) hp:SetStatusBarTexture('Interface\\AddOns\\TestUI\\media\\playerhp') hp:SetStatusBarColor(0,1,0) hp:RegisterUnitEvent('UNIT_HEALTH', frametype) if (frametype == 'target') then hp:SetReverseFill(true) hp:GetStatusBarTexture():SetTexCoord(1,0,0,1) hp:GetStatusBarTexture():SetPoint('RIGHT', hp) end local function HealthUpdate() local hpcur, hpmax = UnitHealth(frametype), UnitHealthMax(frametype) hp:SetMinMaxValues(0,hpmax) hp:SetValue(hpcur) end hp:HookScript("OnEvent",HealthUpdate) local function CheckCoords() print(frametype.." : "..hp:GetStatusBarTexture():GetPoint()) print(hp:GetStatusBarTexture():GetTexCoord()) end frame:HookScript('OnMouseUp',CheckCoords) end
Seems like not being able to use hp:GetStatusBarTexture():SetTexCoord(1,0,0,1) to flip the texture is largely down to how the game handles statusbars? I don't know if I'm writing something wrong here or what, but testing around with it showed me that the statusbars were narrowing by changing the TexCoords directly. So no matter what it was set to before, it'd change back to 0,1,0,1 and then gradually drop down from there.
GetStatusBarTexture():GetPoint() defaulted to TOPLEFT, and trying to SetPoint() did absolutely nothing.
|
Hi Folji,
That's exactly what I have experienced.
Like you said, no matter what change is made, it changes back to 0, 1, 0, 1
![Frown](//cdn-wow.mmoui.com/images/style_mmoi_wowi2/smilies/frown.gif)