Quantcast texture drawing order? - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
02-26-16, 02:19 AM   #1
jeAz_
A Deviate Faerie Dragon
Join Date: Feb 2016
Posts: 13
texture drawing order?

Hi all,

So, I was trying to create a cast bar and reached here to ask a question regarding drawing orders of texture.

Please have a look at the lines of code that I wrote:
Lua Code:
  1. A.CreateCastBar = function(f, unit)
  2.     local point, relativeTo, relativePoint, xOfs, yOfs = unpack(G[unit]["castbar"]["point"]);
  3.  
  4.     local CastBar = CreateFrame("Frame", f:GetName() .. "CastBar", f);
  5.     CastBar:SetSize(G[unit]["castbar"]["width"], G[unit]["castbar"]["height"]);
  6.     CastBar:SetPoint(point, relativeTo, relativePoint, xOfs, yOfs);
  7.  
  8.     local Bar = CreateFrame("StatusBar", nil, CastBar);
  9.     Bar:SetSize(CastBar:GetWidth() - 36, CastBar:GetHeight() - 4);
  10.     Bar:SetPoint("RIGHT", CastBar, "RIGHT", -2, 0);
  11.     Bar:SetStatusBarTexture(BACKDROP);
  12.     Bar:SetStatusBarColor(0.5, 0.5, 1, 1);
  13.  
  14.     CastBar.Bar = Bar;
  15.  
  16.     local bg = Bar:CreateTexture(nil, "BACKGROUND");
  17.     bg:SetAllPoints(true);
  18.     bg:SetTexture(BACKDROP);
  19.     bg:SetVertexColor(1, 1, 1, 1);
  20.  
  21.     CastBar.bg = bg;
  22.  
  23.     local background = Bar:CreateTexture(nil, "BACKGROUND");
  24.     background:SetSize(Bar:GetWidth() + 4, Bar:GetHeight() + 4);
  25.     background:SetPoint("CENTER", Bar, "CENTER", 0, 0);
  26.     background:SetTexture(BACKDROP);
  27.     background:SetVertexColor(0.1, 0.1, 0.1, 1);
  28.  
  29.     CastBar.background = background;
  30.  
  31.     local Icon = CreateFrame("Frame", nil, CastBar);
  32.     Icon:SetSize(CastBar:GetHeight() - 4, CastBar:GetHeight() - 4);
  33.     Icon:SetPoint("LEFT", CastBar, "LEFT", 2, 0);
  34.  
  35.     CastBar.Icon = Icon;
  36.  
  37.     local texture = Icon:CreateTexture(nil, "OVERLAY");
  38.     texture:SetAllPoints(true);
  39.     texture:SetTexture(BACKDROP);
  40.     texture:SetVertexColor(0.5, 0.5, 1, 1);
  41.  
  42.     Icon.texture = texture;
  43.  
  44.     background = Icon:CreateTexture(nil, "BACKGROUND");
  45.     background:SetSize(Icon:GetWidth() + 4, Icon:GetHeight() + 4);
  46.     background:SetPoint("CENTER", Icon, "CENTER", 0, 0);
  47.     background:SetTexture(BACKDROP);
  48.     background:SetVertexColor(0.1, 0.1, 0.1, 1);
  49.  
  50.     Icon.background = background;
  51. end

and my problematic part is here:
Lua Code:
  1. local bg = Bar:CreateTexture(nil, "BACKGROUND");
  2. bg:SetAllPoints(true);
  3. bg:SetTexture(BACKDROP);
  4. bg:SetVertexColor(1, 1, 1, 1);
  5.  
  6. CastBar.bg = bg;
  7.  
  8. local background = Bar:CreateTexture(nil, "BACKGROUND");
  9. background:SetSize(Bar:GetWidth() + 4, Bar:GetHeight() + 4);
  10. background:SetPoint("CENTER", Bar, "CENTER", 0, 0);
  11. background:SetTexture(BACKDROP);
  12. background:SetVertexColor(0.1, 0.1, 0.1, 1);
  13.  
  14. CastBar.background = background;

Since "bg" and "background" are drawn on same layer, it does not draw "bg" on screen.

Any helps please?
  Reply With Quote
 

WoWInterface » Developer Discussions » Graphics Help » texture drawing order?

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