WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Graphics Help (https://www.wowinterface.com/forums/forumdisplay.php?f=14)
-   -   Needs Graphics Help regarding frame level and layers. (https://www.wowinterface.com/forums/showthread.php?t=53153)

zork 02-29-16 02:31 AM

You can solve any framelevel and strata issues via frame stacking. This can be done by parenting any frame to the last frame you created.

Like if you want power below health you create power first with all the desired layers and anchor your base health frame to your highest power frame (overlay?).

Example:
local power = CreateFrame("Statusbar",nil,self)
power.overlay = CreateFrame("Frame",nil,power)
local health = CreateFrame("Statusbar",nil,power.overlay)
self.power =power
self.health = health

For statusbar texture. Your texture is 258x34 pixel. If that is the case that is the wrong size. It has to be 256x32 pixel. (Multiplier of 8).

By default any statusbar is stretched into the space given. StatusbarTexture accepts two types of variables. A texture path string and a texture object. You could create a texture beforehand and pass into to SetStatusbarTexture. You do not have to do it that way because GetStatusbarTexture will return the texture object.

Either way. A texture objext can have SetVertTile and SetHorizTile. This will prevent texture stretching and will repeat the texture the way you defined it.

http://wowprogramming.com/docs/widgets/Texture
http://wowprogramming.com/docs/widgets/StatusBar

Layback_ 03-03-16 05:31 AM

Quote:

Originally Posted by zork (Post 313293)
You can solve any framelevel and strata issues via frame stacking. This can be done by parenting any frame to the last frame you created.

Like if you want power below health you create power first with all the desired layers and anchor your base health frame to your highest power frame (overlay?).

Example:
local power = CreateFrame("Statusbar",nil,self)
power.overlay = CreateFrame("Frame",nil,power)
local health = CreateFrame("Statusbar",nil,power.overlay)
self.power =power
self.health = health

For statusbar texture. Your texture is 258x34 pixel. If that is the case that is the wrong size. It has to be 256x32 pixel. (Multiplier of 8).

By default any statusbar is stretched into the space given. StatusbarTexture accepts two types of variables. A texture path string and a texture object. You could create a texture beforehand and pass into to SetStatusbarTexture. You do not have to do it that way because GetStatusbarTexture will return the texture object.

Either way. A texture objext can have SetVertTile and SetHorizTile. This will prevent texture stretching and will repeat the texture the way you defined it.

http://wowprogramming.com/docs/widgets/Texture
http://wowprogramming.com/docs/widgets/StatusBar

Hi zork!

First of all, the reason why my texture had a size of 258x34 was because the website that I use to upload does only support .jpeg/.png/.gif and some kind of basic image formats.

I could've just change the format of this texture with some utilities (like BLP2PNG(?)), but was too lazy to do so :p...

So, after all, I just captured an image and the image got the size of 258x34 and the format of .png.



And about the SetStatusBarTexture/GetStatusBarTexture, could you please explain me with some in details?

In order to create a texture object, don't I need a frame which is going to use that particular texture object?

Like:
Lua Code:
  1. frame.texture = frame:CreateTexture(nil, "OVERLAY");

If so, you mean by this?
Lua Code:
  1. frame.texture = frame:CreateTexture(nil, "OVERLAY");
  2.  
  3. frame.texture:SetTexCoord(0, 1, 1, 0);
  4.  
  5. frame:SetStatusBarTexture(frame.texture);

zork 03-03-16 06:37 AM

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)

Layback_ 03-04-16 07:15 PM

Quote:

Originally Posted by zork (Post 313375)
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)

Hi again zork,

My issue is that Texture:SetTexCoord() simply not working on my code at all (well... within ouF). So, creating fake status bar did not fix the fault here :(...

Since I'm guessing the problem(?) is between oUF and the place where Texture:SetTexCoord() function is called (as it works fine outside oUF), I'll go back to oUF forum and ask if they have any clues regarding this.

zork 03-05-16 06:50 AM

I posted a working solution here:
http://www.wowinterface.com/forums/s...31&postcount=2

Yukyuk 03-05-16 08:40 AM

Quote:

Originally Posted by Yukyuk (Post 313253)
Oops, my bad. I also get a error while opening a blp file.

What can I say, long day with lots of programming and creating tga files :rolleyes:

This is what I do to get BLP files.
Open the file with XNview and do "save as" and choose the TGA format.
Gimp 2 can read TGA files and can save them as CXF files.

This way I can I can edit them if I want.
And save them and Export them as TGA files.
Then they can be used in an Adonn.

jeffy162 03-05-16 09:17 AM

You can use BLPNG Converter to change to .blp's. Read the page, it tells you what it can convert to .blp's. Gimp2 can export them all, so it's a "win-win" situation. You can use Blpc to convert various formats, also, but I linked it because it is a .blp viewer. You can get BLPView if you want to view .blp's natively on your machine. It's a shell extension, so it will provide thumbnail views on a Window's machine. I have a Window's 10 machine, and all of them work for me.

Yukyuk 03-05-16 12:12 PM

@jeffy162, thanks for the pointers, will check them out.

jeffy162 03-05-16 03:39 PM

You're welcome.


All times are GMT -6. The time now is 05:31 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI