View Single Post
04-03-09, 08:14 AM   #8
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Hi Dawn,

I had the same issue with the Vertical (or was it horizontal...?!) direction of statusbars and had to work around it by using created my own SetTexCoord function.

I wanted my round orbs to deplete from top to bottom but the standard functionality just moves the texture down, which does not work for round textures as you found out aswell.

What I did is the following. I used a transparent texture for my statusbar to make it run and anchored a new frame (called filling) to my statusbar. Based on the HP / MP value I change the SetTexCoord of the filling texture. This is what I used for my square orb texture inside the PostUpdateHealth func:

Code:
    self.Health.Filling:SetHeight((lifeact / lifemax) * self.Health:GetWidth())
    self.Health.Filling:SetTexCoord(0,1,  math.abs(lifeact / lifemax - 1),1)
The direction of the statusbar doesn't matter anymore. You just need the lifeact and lifemax variables to calculate the SetTexCoord. Same goes for mana.

Check my helper image: http://img3.abload.de/img/texcoordcg7s.jpg
SetTexCoord is: Left, Right, Top, Bottom
math.abs makes negativ values be positive, don't let you get disturbed here

SetTexCoord(0,1,0,1) would be a filled orb (filling top to bottom)
SetTexCoord(0,1,0.5,1) would be a half filled orb
SetTexCoord(0,1,1,1) you are dead
You need to adjust the height or width (regarding on filling direction) of the texture before applying the SetTexCoord.

Works for me.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 04-03-09 at 08:36 AM.
  Reply With Quote