Thread Tools Display Modes
04-02-09, 06:42 AM   #1
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
a question regarding filling/depleting of bars in different directions

I have a question regarding bars and how they fill. By default they fill from left to right and deplete, from right to left. Is there a way to invert that for one unit frame, i.e. have them fill from right to left and deplete from left to right?

And while I'm on it..... ..... set orientation(vertical) just moves the bar texture down and kinda "out of the frame", and doesn't really fill/deplete it. Is that intended ? I know that's what the API says it should do, but is there a way to really fill/deplete bars in all directions? I'm asking, because it doesn't work for bars/textures that are not a plain texture, but have some art on it. And I'm trying to achieve something that fills a wing texture from right to left and optionally another one from bottom to top.
  Reply With Quote
04-02-09, 08:53 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
By using blizzard default API we can only get bars to fill in one direction (except when you change the orientation)

:SetOrientation('VERTICAL') is probably what you are looking for
  Reply With Quote
04-02-09, 02:15 PM   #3
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Is there another variable I can add when setting vertical ? like 'growth direction' for buffs/debuffs? Because, like I said, vertical will just move the bar texture out of the frame, instead of really filling/depleting it.

I'll try to find out how stuf or pitbull make it possible to fill bars in a different direction.

Last edited by Dawn : 04-02-09 at 02:17 PM.
  Reply With Quote
04-02-09, 02:25 PM   #4
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
This seems to be the most important part of how it's done by stuf. Doesn't really looks possible with oUF as it is, right?


Code:
do  -- statusbar texture orientations
	local setwidth = PlayerFrameBackground.SetWidth
	local setheight = PlayerFrameBackground.SetHeight
	local setcoord = PlayerFrameBackground.SetTexCoord
	local setvalues = {  -- setvalue functions for various statusbar orientations
		h = { normal = {
				normal =  function(this, w, val) setwidth(this, w) setcoord(this, 0, val, 0, 1) end,
				reverse = function(this, w, val) setwidth(this, w) setcoord(this, 1-val, 1, 0, 1) end,
			}, hflip = {
				normal =  function(this, w, val) setwidth(this, w) setcoord(this, 1,0, 1,1, 1-val,0, 1-val,1) end,
				reverse = function(this, w, val) setwidth(this, w) setcoord(this, val,0, val,1, 0,0, 0,1) end,
			}, vflip = {
				normal =  function(this, w, val) setwidth(this, w) setcoord(this, 0,1, 0,0, val,1, val,0) end,
				reverse = function(this, w, val) setwidth(this, w) setcoord(this, 1-val,1, 1-val,0, 1,1, 1,0) end,
			}, hvflip = {
				normal =  function(this, w, val) setwidth(this, w) setcoord(this, 1,1, 1,0, 1-val,1, 1-val,0) end,
				reverse = function(this, w, val) setwidth(this, w) setcoord(this, val,1, val,0, 0,1, 0,0) end,
			},
		}, 
		v = { normal = {
				normal =  function(this, h, val) setheight(this, h) setcoord(this, val,0, 0,0, val,1, 0,1) end,
				reverse = function(this, h, val) setheight(this, h) setcoord(this, 1,0, 1-val,0, 1,1, 1-val,1) end,
			}, hflip = {
				normal =  function(this, h, val) setheight(this, h) setcoord(this, 1-val,0, 1,0, 1-val,1, 1,1) end,
				reverse = function(this, h, val) setheight(this, h) setcoord(this, 0,0, val,0, 0,1, val,1) end,
			}, vflip = {
				normal =  function(this, h, val) setheight(this, h) setcoord(this, val,1, 0,1, val,0, 0,0) end,
				reverse = function(this, h, val) setheight(this, h) setcoord(this, 1,1, 1-val,1, 1,0, 1-val,0) end,
			}, hvflip = {
				normal =  function(this, h, val) setheight(this, h) setcoord(this, 1-val,1, 1,1, 1-val,0, 1,0) end,
				reverse = function(this, h, val) setheight(this, h) setcoord(this, 0,1, val,1, 0,0, val,0) end,
			},
		},
	}
	-------------------------------------------------------------------
	function Stuf:GetTexCoordOptions(isvertical, flipoption, isreverse)
	-------------------------------------------------------------------
		return setvalues[(isvertical and "v") or "h"][flipoption or "normal"][(isreverse and "reverse") or "normal"]
	end
end
  Reply With Quote
04-02-09, 02:38 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
It is possible, very easily, and I use "reverse" status bars in my oUF layout.

Basically instead of:
Code:
statusbar:SetValue(value)
You just do:
Code:
statusbar:SetValue(maxValue - value)
Note that for oUF this means you will need to run your own health update function, either OverrideUpdateHealth or PostUpdateHealth. It's also slightly buggy (for oUF) in that the first time you see a frame (other than the player unit) the bar will probably be "backwards". It will fix itself once the health updates though. I should probably report that to Haste...
  Reply With Quote
04-02-09, 06:07 PM   #6
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Cool, thanks. Will this work on all bars, or can this be set to work for just those bars I want it to work? Is you oUf layout available somewhere, to get an idea of how the health update functions are done in this case?

What I try to achieve with oUF is this - have the wings to the left fill to the left side of the screen and deplete to the right and the wings on the right side vice versa.







The wings are hp on the left and power on the right. While the yellowish parts (outer wings) are allways visible the red/blue parts fill/empty when you lose/gain hp/power.

I have to figure out how to set everything up, position, size, .. I'm also thinking about using the wings on the left for player and on the right for target, to save some space. I'm not so sure about the target portrait, either. It's not possible to make a real round one, and that looks stupid from time to time, even more since the game doesn't know all "SetCamera(1) aka full body" models by default and "SetCamera(0) aka Portrait" looks even more stupid on a round shape. I will most likely put the minimap there, instead.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » a question regarding filling/depleting of bars in different directions


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