Thread Tools Display Modes
11-27-10, 10:51 PM   #21
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by SDPhantom View Post
Heh... swapped the wrong values in my previous fix. Should be corrected now. The aim of the experimental code is to make storing orientation obsolete since it could be derived from the point set. The texture flip was intended to be in the design from the start, but my original formulas were glitched.
It can not be derived from the point set unless another texture is made or some sort of if on another function variable is done like i did. And i still cant come up with the right combo. It boils down to doing it your way means i HAVE to make another texture for the fill textures which means i have to add 4 more textures total to it.

DHUD and all the others use only one texture and they reverse the tex coords.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-27-10 at 10:53 PM.
  Reply With Quote
11-27-10, 11:20 PM   #22
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Your setpoint get method works fine as far as the orientation of how the bar fills but if you want to flip the bar fill texture we will have to add the if's like i did or something of that nature. So that a texture that looks like "(" will now look like ")"
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
11-28-10, 12:06 AM   #23
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
Hmm... After thinking through the code for a while, I think I found the flaw inherit to the original design. The fact it is incapable of flipping on an axis unrelated to its fill direction. Example, you want to flip horizontally while the bar is set to fill vertically.

It was written from the view that you'd be doing a horizontal fill with a horizontal flip, which honestly, isn't seen in any HUD addon other than my current in-house one.

Here's a new version using the old fill direction code with a separate flip processing section.
lua Code:
  1. local function SetBarValue(bar,val1,val2,flipH,flipV)-- Accepts 5 values, bar texture, start value, end value, and flip flags (horizontal and vertical)
  2. --  Keep the values within a 0-1 range
  3.     val1=math.min(math.max(val1,0),1);
  4.     val2=math.min(math.max(val2,0),1);
  5.  
  6. --  Sometimes textures glitch when trying to set a width or height of 0, so handle it here
  7.     if val1==val2 then
  8.         bar:Hide();
  9.         return;
  10.     else
  11.         bar:Show();
  12.     end
  13.  
  14. --  Set our low and high values
  15.     local low,high=math.min(val1,val2),math.max(val1,val2);
  16.  
  17. --  Find our parent width and height
  18.     local parent=bar:GetParent();
  19.     local w,h=parent:GetWidth(),parent:GetHeight();
  20.  
  21. --  Get our point set, we'll use this to get our bar orientation
  22.     local point=bar:GetPoint(1);
  23.     if not point then return; end-- Handle if point isn't set, perhaps cleared?
  24.  
  25. --  These are our temp origin variables (note one of these pairs can have both vars nil, just use default texcoords for those)
  26.     local origL=point:find("LEFT$");
  27.     local origR=point:find("RIGHT$");
  28.     local origT=point:find("^TOP");
  29.     local origB=point:find("^BOTTOM");
  30.  
  31. --  Reset point
  32.     bar:SetPoint(point
  33.         ,(origL or origR) and (origL and low*w or -low*w) or 0--    X offset
  34.         ,(origT or origB) and (origB and low*h or -low*h) or 0--    Y offset
  35.     );
  36.  
  37. --  Texcoord calc
  38.     local l,r,t,b=0,1,0,1;--    Texcoords are in the range of 0-1 with their origin at top left
  39.     if origL then
  40.         l,r=low,high;
  41.     elseif origR then
  42.         l,r=1-high,1-low;
  43.     end
  44.     if origT then
  45.         t,b=low,high;
  46.     elseif origB then
  47.         t,b=1-high,1-low;
  48.     end
  49.  
  50. --  Process flip (affects which side the bar piece is drawn from too)
  51.     if flipH then l,r=1-l,1-r; end
  52.     if flipV then t,b=1-t,1-b; end
  53.  
  54. --  Apply texcord/size
  55.     bar:SetTexCoord(l,r,t,b);
  56.     bar:SetWidth(w*math.abs(r-l));
  57.     bar:SetHeight(h*math.abs(b-t));
  58. end
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-28-10, 07:08 AM   #24
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
That does it Ive noticed one thing... the bars are somewhat inaccurate, the bar does not appear to begin to empty until almost 100 or more life lost. same with mana... anyway to make it more accurate with its calculations? The mana bar is much worse it thinks its full with over 2000 mana out.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
11-28-10, 07:22 AM   #25
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
What values are being passed to it? The function only accepts percent values in the range of 0-1.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-28-10, 09:19 AM   #26
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
this is the to event handlers for the health and mana, pretty much the same as you had it although the mana one is adjusted to change the color of the bar according to what type of power and does not use the other coloring method.

lua Code:
  1. PlayerHBar:RegisterEvent("PLAYER_ENTERING_WORLD");
  2. PlayerHBar:RegisterEvent("UNIT_HEALTH");
  3. PlayerHBar:RegisterEvent("UNIT_HEALTH_PREDICTION");
  4.  
  5. PlayerHBar:SetScript("OnEvent",function(self,event)
  6.     --  Stop handler if unit not player
  7.     --if not UnitIsUnit(unit,"player") then return; end
  8.     --  Temp vars
  9.     local hcur,hmax,heal=UnitHealth("player"),UnitHealthMax("player"),UnitGetIncomingHeals("player") or 0;--    UnitGetIncomingHeals() can return nil for unsupported units
  10.     local hppcnt=hcur/math.max(1,hmax);
  11.     local healpcnt=heal/math.max(1,hmax);
  12.  
  13.     --  Set our bars (notice the HealBar is a partial bar since it has a start value greater than zero)
  14.     addon:SetBarValue(self.HealthBar,0,hppcnt);
  15.     addon:SetBarValue(self.HealBar,hppcnt,hppcnt+healpcnt);
  16.  
  17.     --  Color HealthBar (we're keeping HealBar white)
  18.     --  This color formula ranges in color from green, to yellow, to red
  19.     self.HealthBar:SetVertexColor(math.min(2-2*hppcnt,1),math.min(2*hppcnt,1),0);
  20. end)
  21.  
  22. PlayerMBar:RegisterEvent("PLAYER_ENTERING_WORLD");
  23. PlayerMBar:RegisterEvent("UNIT_POWER", "player");
  24.  
  25. PlayerMBar:SetScript("OnEvent",function(self,event)
  26.     local pcur, pmax, ptype = UnitPower("player"), UnitPowerMax("player"), UnitPowerType("player");
  27.  
  28.     --local hcur,hmax,heal=UnitHealth("player"),UnitHealthMax("player"),UnitGetIncomingHeals("player") or 0;--    UnitGetIncomingHeals() can return nil for unsupported units
  29.     local mppcnt = pcur/math.max(1,pmax);
  30.  
  31.  
  32.     --  Set our bars (notice the HealBar is a partial bar since it has a start value greater than zero)
  33.     addon:SetBarValue(self.ManaBar,0,mppcnt, "flipH");
  34.  
  35.  
  36.     --  Color HealthBar (we're keeping HealBar white)
  37.      if ptype == 0 then
  38.         self.ManaBar:SetVertexColor(.556, .556, .921, 1)
  39.     elseif ptype == 1 or 2 or 3 or 6 then
  40.         self.ManaBar:SetVertexColor(.656, .456, .456, 1)
  41.     end
  42. end)
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
11-28-10, 09:37 AM   #27
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
The code "looks" fine, what are the dimensions for the bar texture and what is your max health/mana?
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-28-10, 12:13 PM   #28
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by SDPhantom View Post
The code "looks" fine, what are the dimensions for the bar texture and what is your max health/mana?
you mean like what are the dimensions of the blp/tga file itself? good question. I noticed the comment about how you should set the height width to be the same as the texture size. Maybe that is the problem. I will check the sizes and try it and be back in a bit.

edit- okay so its 128x256 on all the textures, i changed up the sizes to reflect that but still its off. my max health is 36604 and mana is 31626
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-28-10 at 12:20 PM.
  Reply With Quote
11-28-10, 01:01 PM   #29
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
what if we change the math from turning it into a percent to making it the actual number. That would be most accurate and i think it is why it fills before it should... when it hits a less then 1% amount it shows it filled all the way. so from 0 - 0.99% the bar is filled... or instead of changing it from percent add a decimal to the number system so that it reads the 0.01 - 0.99% which would also make it more accurate... not as accurate as the actual number. Im good with the theory just not so good with the actual math in code

edit - my numbers are off it would actually be when the bar displays 99.00- 99.99% i would imagine although i have not tested it the same will go for the low end. ex. your bar will show empty before you actually die when it trys to display the 0.99-0.01%

edit - another thought... the math system most likely rounds percents that do not have decimals in the equation. My guess is its right at 99.50% that it shows filled and that last .50 gets lost.

yet another edit - thinking about it and trying to come up with a solution i realized the heal prediction bar is most likely off by the same .xx% amounts.

yet again... - im not positive i understand this entirely but would it be as simple as changing local hppcnt=hcur/math.max(1,hmax); to local hppcnt=hcur/math.max(0.01,hmax);

And no its not at 99.50% its more like 95%
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-28-10 at 01:17 PM.
  Reply With Quote
11-28-10, 03:11 PM   #30
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
same issue with the pet bars only a lot worse since they are much smaller textures but the same canvas size. The problem is not with the numbers and %'s but with the texture getting its top origin from the canvas edge..


Okay... one last variable needs to be added to the function. One that allows you to set the texture edge offset. So lets say your ( is 250 pixels top to bottom but your canvas itself is 256, as all textures have to be powers of 2, the new variable would allow for one to set the graphic within the textures offset... hmmm crap well depending on the orientation of the bar you would actually need 4 settings. For my bar layout i only need the top to bottom settings but yea.... need another variable to accommodate for textures that do not fill the canvas size. The way things are right now what ever the difference is between the graphic and the texture canvas edges is being lost.

Is there any limit to the number of variables passed to a function? hope not lol...
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-28-10 at 03:23 PM.
  Reply With Quote
11-28-10, 05:02 PM   #31
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
I was talking about the UI texture object that you load the image into, and with health and mana at 40k+ starting at 80, you'd have to have a pretty large chunk taken out of your pool before the bar can even move one pixel. Also be aware of any transparent pixels padding the bar in the actual image, they'd be read in as part of the bar too.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-28-10, 05:19 PM   #32
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by SDPhantom View Post
I was talking about the UI texture object that you load the image into, and with health and mana at 40k+ starting at 80, you'd have to have a pretty large chunk taken out of your pool before the bar can even move one pixel. Also be aware of any transparent pixels padding the bar in the actual image, they'd be read in as part of the bar too.
Yea the problem is the padding is reading as part of the bar. That is the whole problem it would appear. Question is how to figure in that padding distance because unfortunately i can not remove it all. It should be possible to add another variable to the function that allows you to enter the padding offsets to the calculation. This is what things are looking like right now in whole. I know its doable. It should be as simple as adding the padding offsets to the texcoord settings somewhere.

lua Code:
  1. local addonName, addon = ...
  2.  
  3. addon:RegisterDefaultSetting("hudShow", true)
  4. addon:RegisterDefaultSetting("hudWidth", 100)
  5. addon:RegisterDefaultSetting("hudHeight", 100)
  6. addon:RegisterDefaultSetting("hudScale", 1)
  7.  
  8. local GHudMain = CreateFrame("Frame", "GHudMain", UIParent)
  9.  
  10. GHudMain:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
  11. GHudMain:SetHeight(3)
  12. GHudMain:SetWidth(3)
  13.  
  14. GHudMain:RegisterEvent("PLAYER_TARGET_CHANGED")
  15. GHudMain:RegisterEvent("UNIT_PET", "player")
  16. GHudMain:SetScript("OnEvent", function(event)
  17.     addon:SetHudBackgrounds()
  18. end)
  19.  
  20. function addon:SetupGHud()
  21.     if addon.settings.hudShow then
  22.         GHudMain:Show()
  23.     else
  24.         GHudMain:Hide()
  25.     end
  26. end
  27.  
  28. function addon:GHudScale()
  29.     GHudMain:SetScale(addon.settings.hudScale)
  30. end
  31.  
  32. --[[-----------------------------------------------------------------------------
  33. The IMPORTANT PART! Bar fill function, dont f with this.
  34. -------------------------------------------------------------------------------]]
  35. function addon:SetBarValue(bar,val1,val2, topoff, bottomoff, rightoff, leftoff, flipH,flipV)-- Accepts 3 values, bar texture, start value, and end value
  36.     --  Keep the values within a 0-1 range
  37.     val1=math.min(math.max(val1,0),1);
  38.     val2=math.min(math.max(val2,0),1);
  39.     --  Sometimes textures glitch when trying to set a width or height of 0, so handle it here
  40.     if val1==val2 then
  41.         bar:Hide();
  42.         return;
  43.     else
  44.         bar:Show();
  45.     end
  46.     --  Set our low and high values
  47.     local low,high = math.min(val1,val2),math.max(val1,val2);
  48.    
  49.    
  50.     if bottomoff ~= 0 then
  51.         --low = math.min(val1-bottomoff,val2-bottomoff)
  52.     end
  53.     if topoff ~= 0 then
  54.         --high = math.max(val1-topoff,val2-topoff);
  55.     end
  56.     if rightoff ~= 0 then
  57.    
  58.     end
  59.     if leftoff ~= 0 then
  60.    
  61.     end
  62.    
  63.     --  Find our parent width and height
  64.     local parent=bar:GetParent();
  65.     local w,h=parent:GetWidth(),parent:GetHeight();
  66.     --  Get our point set, we'll use this to get our bar orientation
  67.     local point=bar:GetPoint(1);
  68.     if not point then return; end-- Handle if point isn't set, perhaps cleared?
  69.     --  These are our temp origin variables (note one of these pairs can have both vars nil, just use default texcoords for those)
  70.     local origL=point:find("LEFT$");
  71.     local origR=point:find("RIGHT$");
  72.     local origT=point:find("^TOP");
  73.     local origB=point:find("^BOTTOM");
  74.     --  Reset point (logic nightmare)
  75.     bar:SetPoint(point
  76.         ,(origL or origR) and (origL and low*w or -low*w) or 0--    X offset
  77.         ,(origT or origB) and (origB and low*h or -low*h) or 0--    Y offset
  78.     );
  79.     --  Texcoord/Size set (this is actually the easy part)
  80.     local l,r,t,b = 0,1,0,1;--    Texcoords are in the range of 0-1 with their origin at top left
  81.     if origL then
  82.         l,r = low, high;
  83.     elseif origR then
  84.         l,r = 1-high,1-low;
  85.     end
  86.     if origT then
  87.         t,b = low,high;
  88.     elseif origB then
  89.         t,b = 1-high,1-low;
  90.     end
  91.     --  Process flip (affects which side the bar piece is drawn from too)
  92.     if flipH then l,r=1-l,1-r; end
  93.     if flipV then t,b=1-t,1-b; end
  94.    
  95.     bar:SetTexCoord(l,r,t,b);
  96.     bar:SetWidth(w*math.abs(r-l));
  97.     --bar:SetWidth(w*(r-l));
  98.     bar:SetHeight(h*math.abs(b-t));
  99.     --bar:SetHeight(h*(b-t));
  100. end
  101.  
  102. --[[-----------------------------------------------------------------------------
  103. Main Bar Creations
  104. -------------------------------------------------------------------------------]]
  105. local PlayerHBar = CreateFrame("Frame",nil, GHudMain);
  106. local PlayerMBar = CreateFrame("Frame",nil, GHudMain);
  107. local TargetHBar = CreateFrame("Frame",nil, GHudMain);
  108. local TargetMBar = CreateFrame("Frame",nil, GHudMain);
  109. local PPetHBar = CreateFrame("Frame",nil, GHudMain);
  110. local PPetMBar = CreateFrame("Frame",nil, GHudMain);
  111.  
  112. function addon:LayoutHudBars()
  113.     PlayerHBar:ClearAllPoints()
  114.     PlayerHBar:SetPoint("RIGHT", GHudMain, "LEFT", - addon.settings.hudWidth, addon.settings.hudHeight);-- Place frame wherever
  115.     PlayerMBar:ClearAllPoints()
  116.     PlayerMBar:SetPoint("LEFT", GHudMain, "RIGHT", addon.settings.hudWidth, addon.settings.hudHeight);
  117.    
  118.     TargetHBar:ClearAllPoints()
  119.     TargetHBar:SetPoint("RIGHT", GHudMain, "LEFT", - addon.settings.hudWidth, addon.settings.hudHeight);-- Place frame wherever
  120.     TargetMBar:ClearAllPoints()
  121.     TargetMBar:SetPoint("LEFT", GHudMain, "RIGHT", addon.settings.hudWidth, addon.settings.hudHeight);
  122.  
  123.     PPetHBar:ClearAllPoints()
  124.     PPetHBar:SetPoint("RIGHT", GHudMain, "LEFT", - addon.settings.hudWidth, addon.settings.hudHeight);-- Place frame wherever
  125.     PPetMBar:ClearAllPoints()
  126.     PPetMBar:SetPoint("LEFT", GHudMain, "RIGHT", addon.settings.hudWidth, addon.settings.hudHeight);
  127. end
  128.  
  129. PlayerHBar:SetWidth(128);--Width
  130. PlayerHBar:SetHeight(256);--Height
  131.  
  132. PlayerMBar:SetWidth(128);--Width
  133. PlayerMBar:SetHeight(256);--Height
  134.  
  135. TargetHBar:SetWidth(128);--Width
  136. TargetHBar:SetHeight(256);--Height
  137.  
  138. TargetMBar:SetWidth(128);--Width
  139. TargetMBar:SetHeight(256);--Height
  140.  
  141. PPetHBar:SetWidth(128);--Width
  142. PPetHBar:SetHeight(256);--Height
  143.  
  144. PPetMBar:SetWidth(128);--Width
  145. PPetMBar:SetHeight(256);--Height
  146.  
  147.  
  148. --  Note: It's generally a good idea to use the same dimensions as your image file for your frame size
  149.  
  150. function addon:SetHudBackgrounds()
  151.     if UnitExists("target") then
  152.         if UnitExists("pet") then
  153.             PlayerHBar.Background:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\bg_21p");--   Your bar image
  154.             PlayerMBar.Background:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\bg_21p");--Your bar image
  155.         else
  156.             PlayerHBar.Background:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\bg_21");--   Your bar image
  157.             PlayerMBar.Background:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\bg_21");--Your bar image
  158.         end
  159.     else
  160.         if UnitExists("pet") then
  161.             PlayerHBar.Background:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\bg_1p");--   Your bar image
  162.             PlayerMBar.Background:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\bg_1p");--Your bar image
  163.         else
  164.             PlayerHBar.Background:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\bg_1");--   Your bar image
  165.             PlayerMBar.Background:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\bg_1");--Your bar image
  166.         end
  167.     end
  168. end
  169.  
  170. --Left Side
  171. --  Background texture
  172. PlayerHBar.Background = PlayerHBar:CreateTexture(nil,"BACKGROUND");
  173. PlayerHBar.Background:SetAllPoints(PlayerHBar);--We want the texture spread to match the dimensions of the frame.
  174. PlayerHBar.Background:SetAlpha(0.25)--Special suprize (black background at a quarter alpha)
  175.  
  176. --Right Side
  177. --  Background texture
  178. PlayerMBar.Background = PlayerMBar:CreateTexture(nil,"BACKGROUND");
  179. PlayerMBar.Background:SetAllPoints(PlayerMBar);--We want the texture spread to match the dimensions of the frame.
  180. PlayerMBar.Background:SetAlpha(0.25)
  181. PlayerMBar.Background:SetTexCoord(1,0,0,1)
  182.  
  183.  
  184.  
  185. --[[-----------------------------------------------------------------------------
  186. Player Bars
  187. -------------------------------------------------------------------------------]]
  188. PlayerHBar.HealthBar = PlayerHBar:CreateTexture(nil,"ARTWORK");--Notice the change in layers, this makes the bar draw on top of the background
  189. PlayerHBar.HealthBar:SetPoint("BOTTOM");--We need only one point set, in this example, the bar fills toward the right, so we need it left-aligned
  190. PlayerHBar.HealthBar:SetWidth(128);--Match frame width for now
  191. PlayerHBar.HealthBar:SetHeight(256);--Match frame height for now
  192. PlayerHBar.HealthBar:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\1");--Be sure to use the same image or one derived from the background
  193.  
  194. -- Player Mana Texture
  195. PlayerMBar.ManaBar = PlayerMBar:CreateTexture(nil,"ARTWORK");--Notice the change in layers, this makes the bar draw on top of the background
  196. PlayerMBar.ManaBar:SetPoint("BOTTOM");--We need only one point set, in this example, the bar fills toward the right, so we need it left-aligned
  197. PlayerMBar.ManaBar:SetWidth(128);--Match frame width for now
  198. PlayerMBar.ManaBar:SetHeight(256);--Match frame height for now
  199. PlayerMBar.ManaBar:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\1");--Be sure to use the same image or one derived from the background
  200.  
  201. --  Heal prediction texture (this'll be my example of a partial bar)
  202. PlayerHBar.HealBar = PlayerHBar:CreateTexture(nil,"ARTWORK");--         Use the same layer as Healthbar
  203. PlayerHBar.HealBar:SetPoint("BOTTOM");--                   Use the same point for the HealthBar
  204. PlayerHBar.HealBar:SetWidth(128);--                    Match frame width for now
  205. PlayerHBar.HealBar:SetHeight(256);--                    Match frame height for now
  206. PlayerHBar.HealBar:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\1");--  Be sure to use the same image or one derived from the background
  207.  
  208. PlayerHBar:RegisterEvent("PLAYER_ENTERING_WORLD");
  209. PlayerHBar:RegisterEvent("UNIT_HEALTH", "player");
  210. PlayerHBar:RegisterEvent("UNIT_HEALTH_PREDICTION");
  211.  
  212. PlayerHBar:SetScript("OnEvent",function(self,event)
  213.     --  Stop handler if unit not player
  214.     --if not UnitIsUnit(unit,"player") then return; end
  215.     local hcur,hmax,heal=UnitHealth("player"),UnitHealthMax("player"),UnitGetIncomingHeals("player") or 0;--    UnitGetIncomingHeals() can return nil for unsupported units
  216.     local hppcnt=hcur/math.max(1,hmax);
  217.     local healpcnt=heal/math.max(1,hmax);
  218.     --  Set our bars (notice the HealBar is a partial bar since it has a start value greater than zero)
  219.     addon:SetBarValue(self.HealthBar,0,hppcnt, 0, 0, 0, 0);
  220.     addon:SetBarValue(self.HealBar,hppcnt,hppcnt+healpcnt, 0, 0, 0, 0);
  221.     --  Color HealthBar (we're keeping HealBar white)
  222.     --  This color formula ranges in color from green, to yellow, to red
  223.     self.HealthBar:SetVertexColor(math.min(2-2*hppcnt,1),math.min(2*hppcnt,1),0);
  224.  
  225. end)
  226.  
  227. PlayerMBar:RegisterEvent("PLAYER_ENTERING_WORLD");
  228. PlayerMBar:RegisterEvent("UNIT_POWER", "player");
  229.  
  230. PlayerMBar:SetScript("OnEvent",function(self,event)
  231.     local pcur, pmax, ptype = UnitPower("player"), UnitPowerMax("player"), UnitPowerType("player");
  232.     local mppcnt = pcur/math.max(1,pmax);
  233.     --  Set our bars (notice the HealBar is a partial bar since it has a start value greater than zero)
  234.     addon:SetBarValue(self.ManaBar,0,mppcnt, 0, 0, 0, 0, "flipH");
  235.     --  Color HealthBar (we're keeping HealBar white)
  236.      if ptype == 0 then
  237.         self.ManaBar:SetVertexColor(.556, .556, .921, 1)
  238.     elseif ptype == 1 or 2 or 3 or 6 then
  239.         self.ManaBar:SetVertexColor(.656, .456, .456, 1)
  240.     end
  241. end)
  242.  
  243. --[[-----------------------------------------------------------------------------
  244. Target Bars
  245. -------------------------------------------------------------------------------]]
  246. TargetHBar.HealthBar = TargetHBar:CreateTexture(nil,"ARTWORK");--Notice the change in layers, this makes the bar draw on top of the background
  247. TargetHBar.HealthBar:SetPoint("BOTTOM");--We need only one point set, in this example, the bar fills toward the right, so we need it left-aligned
  248. TargetHBar.HealthBar:SetWidth(128);--Match frame width for now
  249. TargetHBar.HealthBar:SetHeight(256);--Match frame height for now
  250. TargetHBar.HealthBar:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\2");--Be sure to use the same image or one derived from the background
  251.  
  252. -- Player Mana Texture
  253. TargetMBar.ManaBar = TargetMBar:CreateTexture(nil,"ARTWORK");
  254. TargetMBar.ManaBar:SetPoint("BOTTOM");--We need only one point set, in this example, the bar fills toward the right, so we need it left-aligned
  255. TargetMBar.ManaBar:SetWidth(128);--Match frame width for now
  256. TargetMBar.ManaBar:SetHeight(256);--Match frame height for now
  257. TargetMBar.ManaBar:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\2");--Be sure to use the same image or one derived from the background
  258.  
  259. TargetHBar:RegisterEvent("PLAYER_ENTERING_WORLD");
  260. TargetHBar:RegisterEvent("PLAYER_TARGET_CHANGED");
  261. TargetHBar:RegisterEvent("UNIT_HEALTH", "target");
  262. TargetHBar:RegisterEvent("UNIT_HEALTH_PREDICTION", "target");
  263.  
  264. TargetHBar:SetScript("OnEvent",function(self,event)
  265.     --  Stop handler if unit not player
  266.     --if not UnitIsUnit(unit,"player") then return; end
  267.     local hcur,hmax,heal=UnitHealth("target"),UnitHealthMax("target"),UnitGetIncomingHeals("target") or 0;--    UnitGetIncomingHeals() can return nil for unsupported units
  268.     local hppcnt=hcur/math.max(1,hmax);
  269.     local healpcnt=heal/math.max(1,hmax);
  270.     --  Set our bars (notice the HealBar is a partial bar since it has a start value greater than zero)
  271.     addon:SetBarValue(self.HealthBar,0,hppcnt, 0, 0, 0, 0);
  272.     --addon:SetBarValue(self.HealBar,hppcnt,hppcnt+healpcnt);
  273.  
  274.     self.HealthBar:SetVertexColor(math.min(2-2*hppcnt,1),math.min(2*hppcnt,1),0);
  275.  
  276. end)
  277.  
  278. TargetMBar:RegisterEvent("PLAYER_ENTERING_WORLD");
  279. TargetMBar:RegisterEvent("PLAYER_TARGET_CHANGED");
  280. TargetMBar:RegisterEvent("UNIT_POWER", "target");
  281.  
  282. TargetMBar:SetScript("OnEvent",function(self,event)
  283.     local pcur, pmax, ptype = UnitPower("target"), UnitPowerMax("target"), UnitPowerType("target");
  284.     local mppcnt = pcur/math.max(1,pmax);
  285.     --  Set our bars (notice the HealBar is a partial bar since it has a start value greater than zero)
  286.     addon:SetBarValue(self.ManaBar,0,mppcnt, 0, 0, 0, 0, "flipH");
  287.     --  Color HealthBar (we're keeping HealBar white)
  288.      if ptype == 0 then
  289.         self.ManaBar:SetVertexColor(.556, .556, .921, 1)
  290.     elseif ptype == 1 or 2 or 3 or 6 then
  291.         self.ManaBar:SetVertexColor(.656, .456, .456, 1)
  292.     end
  293. end)
  294.  
  295. --[[-----------------------------------------------------------------------------
  296. Pet Bars
  297. -------------------------------------------------------------------------------]]
  298. PPetHBar.HealthBar = PPetHBar:CreateTexture(nil,"ARTWORK");--Notice the change in layers, this makes the bar draw on top of the background
  299. PPetHBar.HealthBar:SetPoint("BOTTOM");--We need only one point set, in this example, the bar fills toward the right, so we need it left-aligned
  300. PPetHBar.HealthBar:SetWidth(128);--Match frame width for now
  301. PPetHBar.HealthBar:SetHeight(256);--Match frame height for now
  302. PPetHBar.HealthBar:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\p1");--Be sure to use the same image or one derived from the background
  303.  
  304. -- Player Mana Texture
  305. PPetMBar.ManaBar = PPetMBar:CreateTexture(nil,"ARTWORK");
  306. PPetMBar.ManaBar:SetPoint("BOTTOM");--We need only one point set, in this example, the bar fills toward the right, so we need it left-aligned
  307. PPetMBar.ManaBar:SetWidth(128);--Match frame width for now
  308. PPetMBar.ManaBar:SetHeight(256);--Match frame height for now
  309. PPetMBar.ManaBar:SetTexture("Interface\\AddOns\\GrimUI\\HudSkins\\p1");--Be sure to use the same image or one derived from the background
  310.  
  311. PPetHBar:RegisterEvent("PLAYER_ENTERING_WORLD");
  312. PPetHBar:RegisterEvent("PLAYER_TARGET_CHANGED");
  313. PPetHBar:RegisterEvent("UNIT_HEALTH", "pet")
  314. PPetHBar:RegisterEvent("UNIT_LEVEL", "pet")
  315. PPetHBar:RegisterEvent("UNIT_AURA", "pet")
  316. PPetHBar:RegisterEvent("UNIT_MAXHEALTH", "pet")
  317. PPetHBar:RegisterEvent("PLAYER_PET_CHANGED")
  318. PPetHBar:RegisterEvent("UNIT_PET", "player")
  319. PPetHBar:RegisterEvent("UNIT_HEALTH_PREDICTION", "pet");
  320.  
  321. PPetHBar:SetScript("OnEvent",function(self,event)
  322.     --  Stop handler if unit not player
  323.     --if not UnitIsUnit(unit,"player") then return; end
  324.     local hcur,hmax,heal=UnitHealth("pet"),UnitHealthMax("pet"),UnitGetIncomingHeals("pet") or 0;--    UnitGetIncomingHeals() can return nil for unsupported units
  325.     local hppcnt=hcur/math.max(1,hmax);
  326.     local healpcnt=heal/math.max(1,hmax);
  327.     --  Set our bars (notice the HealBar is a partial bar since it has a start value greater than zero)
  328.     addon:SetBarValue(self.HealthBar,0,hppcnt, 175, 25, 0, 0);
  329.     --addon:SetBarValue(self.HealBar,hppcnt,hppcnt+healpcnt);
  330.  
  331.     self.HealthBar:SetVertexColor(math.min(2-2*hppcnt,1),math.min(2*hppcnt,1),0);
  332.  
  333. end)
  334.  
  335. PPetMBar:RegisterEvent("PLAYER_ENTERING_WORLD");
  336. PPetMBar:RegisterEvent("UNIT_HEALTH", "pet")
  337. PPetMBar:RegisterEvent("UNIT_LEVEL", "pet")
  338. PPetMBar:RegisterEvent("UNIT_MANA", "pet")
  339. PPetMBar:RegisterEvent("UNIT_AURA", "pet")
  340. PPetMBar:RegisterEvent("UNIT_DISPLAYPOWER", "pet")
  341. PPetMBar:RegisterEvent("UNIT_ENERGY", "pet")
  342. PPetMBar:RegisterEvent("UNIT_MAXENERGY", "pet")
  343. PPetMBar:RegisterEvent("UNIT_MAXMANA", "pet")
  344.  
  345. PPetMBar:RegisterEvent("PET_UI_UPDATE");
  346. PPetMBar:RegisterEvent("PLAYER_TARGET_CHANGED");
  347. PPetMBar:RegisterEvent("UNIT_POWER", "pet");
  348.  
  349. PPetMBar:SetScript("OnEvent",function(self,event)
  350.     local pcur, pmax, ptype = UnitPower("pet"), UnitPowerMax("pet"), UnitPowerType("pet");
  351.     local mppcnt = pcur/math.max(1,pmax);
  352.     --  Set our bars (notice the HealBar is a partial bar since it has a start value greater than zero)
  353.     addon:SetBarValue(self.ManaBar,0,mppcnt, 175, 25, 0, 0,"flipH");
  354.     --  Color HealthBar (we're keeping HealBar white)
  355.      if ptype == 0 then
  356.         self.ManaBar:SetVertexColor(.556, .556, .921, 1)
  357.     elseif ptype == 1 or 2 or 3 or 6 then
  358.         self.ManaBar:SetVertexColor(.656, .456, .456, 1)
  359.     end
  360. end)
  361. --[[-----------------------------------------------------------------------------
  362. Addon Loaded Initialize
  363. -------------------------------------------------------------------------------]]
  364. addon.RegisterEvent("HUD-Initialize", 'ADDON_LOADED', function(self, event)
  365.     addon.UnregisterEvent(self, event)
  366.     addon:SetupGHud()
  367.     addon:LayoutHudBars()
  368.     addon:SetupGHud()
  369.     addon:SetHudBackgrounds()
  370. end)
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
11-28-10, 06:43 PM   #33
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
Here's the modified function. The default values for the arguments noted below will apply if an argument is missing or is nil. Values marked required are as such.

Syntax:
SetBarValue(bar,val1,val2,flipH,flipV,cropx1,cropx2,cropy1,cropy2)

bar = Bar texture (required)
val1, val2 = Upper and lower values for the bar to be drawn (default 0)
flipH, flipV = Boolean true/false, flips texture horizontally/vertically if true (default false)
cropx1, cropx2, cropy1, cropy2 = Crop values, swapping high and low values within the xy pairs will not affect flipping (default 0, 1, 0, 1)


lua Code:
  1. local function SetBarValue(bar,val1,val2,flipH,flipV,cropx1,cropx2,cropy1,cropy2)-- Accepts 9 values, bar texture, start value, end value, flip flags, and crop offsets (any value exceptbar can be nil)
  2. --  Keep the values within a 0-1 range
  3.     val1=math.min(math.max(val1 or 0,0),1);
  4.     val2=math.min(math.max(val2 or 0,0),1);
  5.  
  6. --  Sometimes textures glitch when trying to set a width or height of 0, so handle it here
  7.     if val1==val2 then
  8.         bar:Hide();
  9.         return;
  10.     else
  11.         bar:Show();
  12.     end
  13.  
  14. --  Texture crop/padding
  15.     cropx1=math.min(math.max(cropx1 or 0,0),1);
  16.     cropx2=math.min(math.max(cropx2 or 1,0),1);
  17.     cropy1=math.min(math.max(cropy1 or 0,0),1);
  18.     cropy2=math.min(math.max(cropy2 or 1,0),1);
  19.  
  20. --  Set our low and high values
  21.     local low,high=math.min(val1,val2),math.max(val1,val2);
  22.  
  23. --  Find our parent width and height
  24.     local parent=bar:GetParent();
  25.     local pw,ph=parent:GetWidth(),parent:GetHeight();
  26.  
  27. --  Get our point set, we'll use this to get our bar orientation
  28.     local point=bar:GetPoint(1);
  29.     if not point then return; end-- Handle if point isn't set, perhaps cleared?
  30.  
  31. --  These are our temp origin variables (note one of these pairs can have both vars nil, just use default texcoords for those)
  32.     local origL=point:find("LEFT$");
  33.     local origR=point:find("RIGHT$");
  34.     local origT=point:find("^TOP");
  35.     local origB=point:find("^BOTTOM");
  36.  
  37. --  Reset point
  38.     bar:SetPoint(point
  39.         ,(origL or origR) and (origL and low*pw or -low*pw) or 0--  X offset
  40.         ,(origT or origB) and (origB and low*ph or -low*ph) or 0--  Y offset
  41.     );
  42.  
  43. --  Texcoord calc
  44.     local l,r,t,b=0,1,0,1;--    Texcoords are in the range of 0-1 with their origin at top left
  45.     if origL then
  46.         l,r=low,high;
  47.     elseif origR then
  48.         l,r=1-high,1-low;
  49.     end
  50.     if origT then
  51.         t,b=low,high;
  52.     elseif origB then
  53.         t,b=1-high,1-low;
  54.     end
  55.  
  56. --  Process flip (affects which side the bar piece is drawn from too)
  57.     if flipH then l,r=1-l,1-r; end
  58.     if flipV then t,b=1-t,1-b; end
  59.  
  60. --  Constrain to crop size
  61.     local cropL,cropR,cropT,cropB=math.min(cropx1,cropx2),math.max(cropx1,cropx2),math.min(cropy1,cropy2),math.max(cropy1,cropy2);
  62.     local cropW,cropH=cropR-cropL,cropB-cropT;
  63.     l,r,t,b=l*cropW+cropL,r*cropW+cropL,t*cropH+cropT,b*cropH+cropT;
  64.  
  65. --  Apply texcord/size
  66.     bar:SetTexCoord(l,r,t,b);
  67.     bar:SetWidth(pw*((origL or origR) and math.abs(high-low) or 1));
  68.     bar:SetHeight(ph*((origT or origB) and math.abs(high-low) or 1));
  69. end
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-28-10, 07:40 PM   #34
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
if you put the crop vars before the flip ones you dont HAVE to enter a flip entry. If you put them ahead of the crop vars you have to enter something for both flips or it trys to pass flip entrys to the crop entrys...

edit -- somthing else is wrong to the bars are not working at all with those changes.

edit-- okay so it has to do with the croping. when i set the bar with the function what exactly show it look like?
this is what it looks like right now. does work if i remove all the crop settings.
this is what it looks like and does not work.
addon:SetBarValue(self.ManaBar,0,mppcnt, true, false, 175, 50, 0 ,0);

hmm how do you bypass a var? ...? or _?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-28-10 at 08:13 PM.
  Reply With Quote
11-28-10, 08:39 PM   #35
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
The cropping does not appear to work at all. It understands 1 and 0 and thats it. what kind of numbers do i need to enter? i found if i enter a - and a + it at lest shows the texture again but its not cropping it... ex:
addon:SetBarValue(self.ManaBar,0,mppcnt, true, false, -175, 50, -175, 50);
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
11-28-10, 09:56 PM   #36
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
Originally Posted by Grimsin View Post
if you put the crop vars before the flip ones you dont HAVE to enter a flip entry. If you put them ahead of the crop vars you have to enter something for both flips or it trys to pass flip entrys to the crop entrys...

...

how do you bypass a var? ...? or _?
With a function like this, there are always going to be a group of parameters you don't need to use. It's up to the programmer to decide what order makes the most sense. The ordering makes no impact on the performance of the code. It really depends on how the function handles parameters, but with functions that have optional parameters in fixed positions and a parameter is missing, it always gets the value of nil. If you need to skip an optional parameter, in most cases you can pass nil to it.





Originally Posted by Grimsin View Post
when i set the bar with the function what exactly show it look like?
this is what it looks like right now. does work if i remove all the crop settings.
addon:SetBarValue(self.ManaBar,0,mppcnt, true, false, 175, 50, 0 ,0);
Originally Posted by Grimsin View Post
The cropping does not appear to work at all. It understands 1 and 0 and thats it. what kind of numbers do i need to enter? i found if i enter a - and a + it at lest shows the texture again but its not cropping it... ex:
addon:SetBarValue(self.ManaBar,0,mppcnt, true, false, -175, 50, -175, 50);
The crop parameters use the same values in the same order as texture:SetTexCoord(). See line 44 of the function for a note on texcoord ranges.

I find it easier to understand when texcoords are written in fraction notation. This would have each x and y coordinate written as x/w and y/h. For example, your image file has the dimensions of 128x256. Say I wanted to grab a piece from it using two corners at coordinates (32,64) and (96,192). This could be written the following ways.

Fraction notation:
Code:
(32/128,96/128,64/256,192/256)
Decimal notation:
Code:
(0.25,0.75,0.25,0.75)


This would end up with the function call looking something like this.
Code:
addon:SetBarValue(self.ManaBar,0,mppcnt,true,false,32/128,96/128,64/256,192/256);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-28-10, 11:50 PM   #37
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
<you see a light bulb appear above Grimsin's head> its all much clearer now. Heh i wish someone had explained texcoords like that on the wiki because it would have made a lot more sense there to.

Now to figure out what direction things are going. I already noticed strange reactions to my settings...

edit--the light has flickered out... umm im not even sure how to explain whats happening... its putting the texture all over the place... doing strange things. It moves it up and down and cuts it and chops it weird ways and what in the world? It kind of looks like if we crop the texture that it then needs to have new setpoints as well im not sure on this. Alright what would you put in order to cut the top 150 pixels off a 256 pixel texture with the code you posted? i only need to set the cropy1 or cropy2 right? and 1 and 2 stands for the top of the texture and the bottom?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-28-10 at 11:58 PM.
  Reply With Quote
11-29-10, 01:20 AM   #38
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
It's the same order as texture:SetTexCoord(). The numbers are in order of Left, Right, Top, and Bottom. These numbers are expressed as a decimal in the range of 0-1. If you look at your image as a coordinate system, the origin is in the upper left corner, top left is (0,0). The coordinates approach (1,1) as you move toward the lower right corner.

Now, to move the top in 150 pixels, you need to set Top to 150/256, Bottom needs to remain at 1. If you're not cropping left/right, leave those values at 0 and 1 respectively. There are also two things you should modify as well, when you do this, the rendered texture is no longer 256px, it'll be more like 106px. You should change the frame and initial texture object heights to reflect this, and don't forget to use the same coordinates to set the background's texcoord or it'll look a but funky.



An example of applying this texcoord to the render function.
Code:
addon:SetBarValue(self.ManaBar,0,mppcnt,true,false,0,1,150/256,1);


Be sure to do this to the background texture too.
Code:
texture:SetTexCoord(0,1,150/256,1);


Edit:
Oh, right... and when you set the texcoord on the background, be sure to flip the first two values if the bar is to be flipped.
Code:
texture:SetTexCoord(1,0,150/256,1);


Originally Posted by Grimsin View Post
i only need to set the cropy1 or cropy2 right? and 1 and 2 stands for the top of the texture and the bottom?
In all honesty, the function was written to not allow you to flip the texture from the crop coordinates. So for the xy pairs, it would select the lowest from the x pair for left, the highest for right. From the y pair, the lowest would be selected for top and highest for bottom. Although, if you pass nil to any coordinate value, it would substitute for what would be the default for that position. For example, x1 is sent nil while x2 is sent 0.5, the pair result would be 0 and 0.5. If x1 was 0.5 and x2 was nil, the pair would result as 0.5 and 1. The same would happen for y1 and y2.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 11-29-10 at 02:21 AM.
  Reply With Quote
11-29-10, 04:31 PM   #39
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
so to shave the top and bottom do i need to make the second variable passed reflect the changes of the first? so if i do the 150/256 then the last entry would be like -10/106? er wait it would be more like 1/10 wouldnt it
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 11-29-10 at 04:44 PM.
  Reply With Quote
11-29-10, 05:09 PM   #40
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
Originally Posted by Grimsin View Post
so to shave the top and bottom do i need to make the second variable passed reflect the changes of the first? so if i do the 150/256 then the last entry would be like -10/106? er wait it would be more like 1/10 wouldnt it
No, it would be more like 150/256 to take 150 off the top and the second y value would be something like 246/256... which is (256-10)/256.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Hud status bar questions.

Thread Tools
Display Modes

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