View Single Post
03-03-16, 06:37 AM   #23
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Any texture you want to create needs a frame to be created on.
A statusbar is just a subtype of the frame element with an additional set of functions.

Make sure to read all the statusbar functions.
http://wowprogramming.com/docs/widgets/StatusBar

To be honest I really don't understand your issue. The statusbar has a rich set of functions providing possible solutions for anything you want. If it does not have what you are looking for do not use a statusbar at all. Instead use a texture object and apply any transformations manually via :SetTexCoord().
http://wowprogramming.com/docs/widge...re/SetTexCoord

You can create a fake statusbar in oUF and hook the "OnValueChanged" event on the fake statusbar to trigger any math calculations on your texture.

Lua Code:
  1. local fakePowerBar = CreateFrame("Statusbar",nil,self)
  2. local powerBar = self:CreateTexture(nil,"BACKGROUND",nil,-8)
  3. powerBar:SetPoint("RIGHT") --or "LEFT", "TOP", "BOTTOM" ... whatever you need
  4. self.Power = fakePowerBar
  5. local function UpdatePowerBar(...)
  6.   print(...)
  7.   local ULx, ULy, LLx, LLy, URx, URy, LRx, LRy
  8.   local width, height
  9.   --calculations are pretty easy. Just take a piece of paper IRL and mark the corners. Now flip it in any direction you want. That is your conversion UL becomes UR and UR becomes UL and so on.
  10.   --What is important is since the texture needs to be cut off once you loose value you need to ajust the corners properly.
  11.   --Your texture will be stretched to full width/height, thus you need to adjust the size to make it look right.
  12.   powerBar:SetTexCoord(ULx, ULy, LLx, LLy, URx, URy, LRx, LRy)
  13.   powerBar:SetSize(width,height)
  14. end
  15.  
  16. self.Power:SetScript("OnValueChanged", UpdatePowerBar)
__________________
| 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 : 03-03-16 at 06:58 AM.
  Reply With Quote