View Single Post
08-21-21, 05:42 AM   #1
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
Texture Coordinates problem.

I'm trying to display a progress bar made with a texture file in a frame. The goal is to set the width of this texture according to a given parameter: let's say from 0 (no visible texture) to 1 (texture fills all the frame's width). At 0.5, the left side of the bar must be filled with the texture.

At this time, I have:
Lua Code:
  1. myFrame.texture:SetTexture(pathToMyTGAfile)
  2.         myFrame.texture:SetTexCoord(0, 0.5, 1, 0.5)
  3.         myFrame.texture:SetAlpha(1)
Whatever the values of SetTexCoord(), the texture fills all the frame's width.
The bar size is 100 (w) x 15 (h) px. The TGA file is 8 (w) x 16 (h) px.

I know it would be easier to create a child frame inside the "bar" frame, fill it with texture and then set the width of the child frame, but in my case, it will lead to others problem. So I would prefer to manage the texture coordinates... If it is possible.

Thank you.
__________________
Zax - Addons List, not all maintained.
  Reply With Quote