Quantcast
Flip a status bar - WoWInterface
Thread Tools Display Modes
03-08-08, 08:21 AM   #1
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Flip a status bar

Hello,

Concern: I would like to have a status bar fill from the right to the left.

I thought that it was possible to flip any frame by using "frame:SetPoint()" to put the Right extremity of the frame to the left of its Left extremity, but it doesn't seem to work at all.

I've tried to find an example of a reversed status bar somewhere, but I couldn't find any (I admit I haven't searched deeply, but I don't remember any of my various unit frames addon to have this kind of option).

Currently, I end up with only one solution, which is to use my own frame prototype and to play with textures a bit, which disappoints me quite a lot :<

Does anyone have an idea?

Thank you
  Reply With Quote
03-08-08, 08:28 AM   #2
Dreadlorde
A Pyroguard Emberseer
 
Dreadlorde's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 2,302
Code:
function DUF_StatusBar_SetValue(bar, value)
	if (value == 0) then value = .01; end
	value = value / 100;
	if (value > 1) then value = 1; end

	if (bar.direction < 3) then
		bar:SetWidth(bar.length * value);
	else
		bar:SetHeight(bar.length * value);
	end

	if (bar.direction == 1) then
		bar:SetTexCoord(0, value, 0, 1);
	elseif (bar.direction == 2) then
		bar:SetTexCoord(value, 0, 0, 1);
	elseif (bar.direction == 3) then
		bar:SetTexCoord(0, 1, value, 0);
	elseif (bar.direction == 4) then
		bar:SetTexCoord(0, 1, 0, value);
	end
end
Does that help?
__________________

Funtoo - Plan 9 - Windows 7
  Reply With Quote
03-08-08, 08:31 AM   #3
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Indeed, that helps. I think that it basically means that DUF used their own bars. It probably means that there is no other way :/ I'll be doing that too, then.

Thank you
  Reply With Quote
03-08-08, 08:44 AM   #4
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Couldn't you just have a statusbar you want to show, behind another statusbar and just use the inverse SetValue to show it?
  Reply With Quote
03-08-08, 08:54 AM   #5
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Originally Posted by Slakah View Post
Couldn't you just have a statusbar you want to show, behind another statusbar and just use the inverse SetValue to show it?
You mean using a status bar to hide the "empty" part of my status bar? If that's what you mean, the problem is that the status bar could be on a transparent background.
  Reply With Quote
03-08-08, 10:49 AM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,757
I'm confused... You just want it to deplete from left to right instead of right to left, correct? Many unit frame mods do this already. PitBull, agUF, XPerl...

edit: for a screenshot, check out Elloria's latest in the screenshots thread (I just looked at it, so it's in my head).
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
03-08-08, 04:46 PM   #7
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Originally Posted by Seerah View Post
I'm confused... You just want it to deplete from left to right instead of right to left, correct? Many unit frame mods do this already. PitBull, agUF, XPerl...

edit: for a screenshot, check out Elloria's latest in the screenshots thread (I just looked at it, so it's in my head).
I'm confused too... Pitbull, agUF and Xperl are 3 of the UF addons I've been using the most recently :>
I didn't check for pitbull and xperl that I don't have anymore, but I haven't found this option in my version of agUF (which is probably not up to date, but is still not really old either). But anyway! Ok! I should have checked in more addons.

As a conclusion, I've finally given up. I'm using something that isn't very neat, but it works (I just have a rectangles and I'm settings their widths manually instead of using a "SetValue()" method). It may be slightly more CPU consuming (even if I think not), and it would give bad results if I wanted to add textures that aren't invariant by horizontal translation (shrinking them instead of just not displaying the left part), but I can really live with it



Oh, just if you want to know about what I'm coding:

I think that the aim of the addon is kinda exciting. It's supposed to monitor the delay between your spell casts. From a mage or warlock's point of view, it's already quite nice if you notice that even with Quartz, you still have occasional delays above 0.15 seconds between your casts, as it's roughly 5% of your DPS that is gone. For a shadowpriest (which is the class I am playing), it's even worse:
- You don't want to cast a spell too early and cut a mind flay right before it ticks (but you may want to cast a spell right after mind flay's second tick, and quartz doesn't have an indicator for when the second tick will be)
- Your spells are shorter, so this 0.15sec delay is an even bigger portion of your damage.

So basically, it's something that you can show up all the time right after you've downloaded it, to see if you really have issues and to estimate the kind of DPS boost you could gain by playing better. After that, it could be nice to have a way to run it in the background, with nothing displayed, with a custom-set check that lets you know when you're starting slacking again
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Flip a status bar

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