Thread Tools Display Modes
11-27-16, 04:01 PM   #1
Tesser
A Deviate Faerie Dragon
Join Date: Oct 2016
Posts: 15
frame and texture layer order / SetDrawLayer()

EDIT - I got it working just by using less textures.

Not sure the original problem thoughI want to layer 4 images on top of each other but it's behaving totally erratically.

They seem to layer in a different random order every time I draw - whichever the processor finishes first or something.

I tried using SetDrawLayer too (end of code) but one of the layers "brazier" refused to draw at all with that on

Code:
forgeFrame.rock=forgeFrame:CreateTexture("rock")
forgeFrame.rock:SetTexture(panda_rock)
forgeFrame.rock:SetTexCoord(0, 1, 0, 1)
forgeFrame.rock:SetPoint("CENTER", forgeFrame, "CENTER", 0, 0)
forgeFrame.rock:SetSize(140, 140)
  
forgeFrame.fire=forgeFrame:CreateTexture("fire")
forgeFrame.fire:SetTexture(circle_fire)
forgeFrame.fire:SetTexCoord(0, 1, 0, 1)
forgeFrame.fire:SetPoint("CENTER", forgeFrame, "CENTER", 0, 0)
forgeFrame.fire:SetSize(135, 135)

forgeFrame.gear=forgeFrame:CreateTexture("gear")
forgeFrame.gear:SetTexture(gear_circle)
forgeFrame.gear:SetTexCoord(0, 1, 0, 1)
forgeFrame.gear:SetPoint("CENTER", forgeFrame, "CENTER", 0, 0)
forgeFrame.gear:SetSize(75, 75)

forgeFrame.brazier=forgeFrame:CreateTexture("brazier")
forgeFrame.brazier:SetTexture(brazier)
forgeFrame.brazier:SetTexCoord(0, 1, 0, 1)
forgeFrame.brazier:SetPoint("CENTER", forgeFrame, "CENTER", 0, 0)
forgeFrame.brazier:SetSize(60, 60)

forgeFrame.rock:SetDrawLayer("BACKGROUND", 0)-- -8 / 7
forgeFrame.fire:SetDrawLayer("BACKGROUND", 1)
forgeFrame.gear:SetDrawLayer("BORDER", 0)
forgeFrame.brazier:SetDrawLayer("HIGHLIGHT", 0)

Last edited by Tesser : 11-27-16 at 04:59 PM.
  Reply With Quote
11-27-16, 05:22 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,324
Did you try the layer and sublevel args for frame:CreateTexture()? The effects of omitting these is undocumented even if you later define them using texture:SetDrawLayer(). Also, HIGHLIGHT is a special layer that only shows on mouseover.

PS: You shouldn't use generic names for your UI objects. These can conflict with the default UI if they ever come out with their own ForgeFrame or other elements. It's common practice to prefix whatever name you choose with the name of your addon. Not only to reduce the likeliness of conflicts with the default UI or other badly written addons, but it makes your frame easily identifiable as to which addon created it. As for textures and fontstrings, it's recommended to not set a name and use the returned handler directly. You can do this by passing nil as the name arg.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-28-16, 05:10 AM   #3
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Texture stacking
Lua Code:
  1. local f1 = CreateFrame("Frame",nil,UIParent)
  2. local t1 = f1:CreateTexture(nil,"BACKGROUND",nil,-8)
  3. local t2 = f1:CreateTexture(nil,"BACKGROUND",nil,-7)
  4. local t3 = f1:CreateTexture(nil,"BACKGROUND",nil,-6)
  5. local t4 = f1:CreateTexture(nil,"BACKGROUND",nil,-5)

Frame and texture stacking
Lua Code:
  1. local f1 = CreateFrame("Frame",nil,UIParent)
  2. local t1 = f1:CreateTexture(nil,"BACKGROUND",nil,-8)
  3. local t2 = f1:CreateTexture(nil,"BACKGROUND",nil,-7)
  4. local f2 = CreateFrame("Frame",nil,f1)
  5. local t3 = f2:CreateTexture(nil,"BACKGROUND",nil,-8)
  6. local t4 = f2:CreateTexture(nil,"BACKGROUND",nil,-7)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » frame and texture layer order / SetDrawLayer()


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