View Single Post
03-14-10, 05:28 PM   #11
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Without derailing on how to modify Alza's UI my suggestion is just stop using CreateGB.

As Akryn said you should only create a texture once, reference and reuse it, it's that simple and here's an example for you.

Code:
local bg = Minimap:CreateTexture(nil, "BACKGROUND")
local offset = UIParent:GetScale() / Minimap:GetEffectiveScale()
bg:SetTexture(0, 0, 0, 1)
bg:SetPoint("BOTTOMRIGHT", offset, -offset)
bg:SetPoint("TOPLEFT", -offset, offset)

local f=CreateFrame("Frame")
f:SetScript("OnEvent", function(self, event, ...)
    local inv = CalendarGetNumPendingInvites()
    local mail = HasNewMail()
    if inv > 0 and mail then -- New invites and mail
        bg:SetTexture(1, .5, 0)
    elseif inv > 0 and not mail then -- New invites and no mail
        bg:SetTexture(1, 30/255, 60/255)
    elseif inv==0 and mail then -- No invites and new mail
        bg:SetTexture(0, 1, 0)
    else -- Default color
        bg:SetTexture(0, 0, 0)
    end
end)

f:RegisterEvent("CALENDAR_UPDATE_PENDING_INVITES")
f:RegisterEvent("UPDATE_PENDING_MAIL")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
Now I only kept offset variable from the function because I don't know what your scale was, otherwise I'd probably just enter a single number like 1 or 2.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 03-14-10 at 05:32 PM.
  Reply With Quote