View Single Post
Old 07-11-09, 01:56 PM   #1
Rhamses
A Theradrim Guardian
Join Date: Jun 2009
Posts: 61
Pie slices for children buttons

Here is the code from the original Demonomicon addon that places the children buttons around the original button.

It might be hard to dream up the code to do it, but it is pretty easy to use it as a template.

-------------------------------------------------------------------------------------------------------------
-- Slice the pie locations
-------------------------------------------------------------------------------------------------------------
if numButtons > 0 then
local angle = Placement.startAngle
local slice = (Placement.endAngle - angle) / numButtons
local radius = 18 / math.sin(slice / 2)
for index=1,numButtons do
Buttons[index]:SetPoint("CENTER", self, "CENTER", radius * math.cos(angle),
radius * math.sin(angle))
angle = angle + slice
end
self.Menu:SetWidth(radius * 2 + 36)
self.Menu:SetHeight(radius * 2 + 36)
end
end
-------------------------------------------------------------------------------------------------------------
-- Load pie slices with Textures
-------------------------------------------------------------------------------------------------------------
Demonomicon:SetScript("OnEvent", function (self, event, ...)
Demonomicon_Locale = {}
Demonomicon_Locale[GetLocale()] = Demonomicon_Locale[GetLocale()] or
({})[GetLocale()] or {}

self.Locale = Demonomicon_Locale[GetLocale()]
Demonomicon_Placement =
{
startAngle = math.pi,
endAngle = 3 * math.pi,
order =
{
self.Textures.Imp,
self.Textures.Infernal,
self.Textures.Voidwalker,
self.Textures.Succubus,
self.Textures.Felhunter,
self.Textures.Felguard
}
}
self.Placement = Demonomicon_Placement
self:SetScript('OnEvent', function (self, event, ...)
self:SetUpButtons(event, ...)end)
end)
Rhamses is offline