Thread Tools Display Modes
07-29-10, 11:13 AM   #1
Tarumi
A Deviate Faerie Dragon
 
Tarumi's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 17
Some questions...

I made my own lite version of TitanPanels/kgPanels and love it. However, I'm having a hard time with the actual bar texture itself. This is what I have (just part of the whole code)

Code:
local f = CreateFrame("FRAME", "Carrie", UIParent)
f:SetBackdrop({bgFile = BLANK_TEXTURE,
                               tileSize = 0, edgeSize = 1,
                               insets = { left = -1, right = -1, top = -1, bottom = -1}
})
f:SetBackdropColor(.2, .2, .2, 1)
f:SetWidth(GetScreenWidth() * UIParent:GetEffectiveScale())
f:SetHeight(15)
f:SetPoint("TOPLEFT", 0, 0)
f:SetPoint("TOPRIGHT", 0, 0)

local t = f:CreateTexture(nil, "ARTWORK")
t:SetTexture(0, 0, 0)
t:SetAllPoints(f)
f.texture = t

local t2 = f:CreateTexture(nil, "BORDER")
t2:SetTexture(1, 1, 1)
t2:SetAllPoints(f)
t2:SetHeight(17)
f.texture = t2
But I'm not sure what all everything does, and I'm 90% sure there is code there that isn't ever being displayed. I got the hang of everything else for the widgets API but frame textures are stumping me.

Right now it has a black~ background with a faint light-grey border. I tried to change this and haven't gotten anywhere, seems I'm stuck. I also want to change the background alpha but if I try setting the alpha it does it for the entire bar (text included).

Any help? Thanks all!
  Reply With Quote
07-29-10, 03:09 PM   #2
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
You are creating several textures for the same frame, that overlay each other. You should see the black texture, this "local t". Since it seems to have the highest DrawLayer (Artwork). You shouldn't see "local t2", or at least not much of it. Since it should be drawn just below "local t". You're setting a height for it, but I doubt this changes anything because you also setallpoints to f.


If you want a frame with a background and a border, you can go with just

SetBackdrop and use a bgfile AND an edgefile for it. You can google SetBackdrop for more information on this matter.

Or you create a texture for the background and the border with
A) another texture that is drawn behind the background and using different SetPoint to overlap the background
B) create the border via SetBackdrop with only an edgefile.

You can change an alpha via SetAlpha or directly where you set a color (.2, .2, .2, 1) .. the red number is the alpha.


As a sidenote: How you where able to "create own lite version of TitanPanels/kgPanels" without knowing about stuff like that is beyond me. Or I must totally have missed your point.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
07-30-10, 06:43 AM   #3
Tarumi
A Deviate Faerie Dragon
 
Tarumi's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 17
Ah, thanks! I got it now so that it doesn't have the SetBackdrop() function call anymore and actually got the background alpha to display properly!

My question now though is how to get a border? If I make my frame's ARTWORK alpha 1 then my BORDER height 1 more than the frames height (to make a 1px border) then it works fine. However, if I have my ARTWORK alpha < 1 the border color shows through in the back...which isn't what I want....how would i just create a simple 1px border?

And I made my addon pretty robust. Outside of try now to play with actually setting the border/background color for the main frame (it does look awesome atm) I picked up on everything else pretty well irt buttons/dropdownmenus/tooltips etc (probably since I have a degree in CompSci). Just for some reason setting a simple border is still not clicking for me :\

Thanks again!
  Reply With Quote
07-30-10, 06:59 AM   #4
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
CompScience has nothing to do with programming, at least in Germany...

If you want a 1px border without overlapping textures... don't overlap them^^.

Code:
-- this is the background of the frame (black)
local t = CreateTexture(nil, 'BORDER')
t:SetTexture(0, 0, 0, 1)
t:SetAllPoints(frame)
frame.texture = t

-- this is the border of the frame, 1px height at the bottom of the frame
t = CreateTexture(nil, 'BORDER')
t:SetTexture(1, 1, 1, 1)
t:SetPoint('TOPLEFT', frame, 'BOTTOMLEFT', 0, 0)
t:SetPoint('BOTTOMRIGHT', frame, 'BOTTOMRIGHT', 0, -1)
frame.border = t
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Some questions...


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