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:
A.CreateCastBar = function(f, unit) local point, relativeTo, relativePoint, xOfs, yOfs = unpack(G[unit]["castbar"]["point"]); local CastBar = CreateFrame("Frame", f:GetName() .. "CastBar", f); CastBar:SetSize(G[unit]["castbar"]["width"], G[unit]["castbar"]["height"]); CastBar:SetPoint(point, relativeTo, relativePoint, xOfs, yOfs); local Bar = CreateFrame("StatusBar", nil, CastBar); Bar:SetSize(CastBar:GetWidth() - 36, CastBar:GetHeight() - 4); Bar:SetPoint("RIGHT", CastBar, "RIGHT", -2, 0); Bar:SetStatusBarTexture(BACKDROP); Bar:SetStatusBarColor(0.5, 0.5, 1, 1); CastBar.Bar = Bar; local bg = Bar:CreateTexture(nil, "BACKGROUND"); bg:SetAllPoints(true); bg:SetTexture(BACKDROP); bg:SetVertexColor(1, 1, 1, 1); CastBar.bg = bg; local background = Bar:CreateTexture(nil, "BACKGROUND"); background:SetSize(Bar:GetWidth() + 4, Bar:GetHeight() + 4); background:SetPoint("CENTER", Bar, "CENTER", 0, 0); background:SetTexture(BACKDROP); background:SetVertexColor(0.1, 0.1, 0.1, 1); CastBar.background = background; local Icon = CreateFrame("Frame", nil, CastBar); Icon:SetSize(CastBar:GetHeight() - 4, CastBar:GetHeight() - 4); Icon:SetPoint("LEFT", CastBar, "LEFT", 2, 0); CastBar.Icon = Icon; local texture = Icon:CreateTexture(nil, "OVERLAY"); texture:SetAllPoints(true); texture:SetTexture(BACKDROP); texture:SetVertexColor(0.5, 0.5, 1, 1); Icon.texture = texture; background = Icon:CreateTexture(nil, "BACKGROUND"); background:SetSize(Icon:GetWidth() + 4, Icon:GetHeight() + 4); background:SetPoint("CENTER", Icon, "CENTER", 0, 0); background:SetTexture(BACKDROP); background:SetVertexColor(0.1, 0.1, 0.1, 1); Icon.background = background; end
and my problematic part is here:
Lua Code:
local bg = Bar:CreateTexture(nil, "BACKGROUND"); bg:SetAllPoints(true); bg:SetTexture(BACKDROP); bg:SetVertexColor(1, 1, 1, 1); CastBar.bg = bg; local background = Bar:CreateTexture(nil, "BACKGROUND"); background:SetSize(Bar:GetWidth() + 4, Bar:GetHeight() + 4); background:SetPoint("CENTER", Bar, "CENTER", 0, 0); background:SetTexture(BACKDROP); background:SetVertexColor(0.1, 0.1, 0.1, 1); CastBar.background = background;
Since "bg" and "background" are drawn on same layer, it does not draw "bg" on screen.
Any helps please?
|