gui/GuiManagerDebug/Frame/newDropFrame.int
Ryan 84bba39187 The library
This is for the love2d engine. Works with the latest version. Look at my intro to software project for some examples on how to use this
2017-06-10 16:06:50 -04:00

37 lines
962 B
Plaintext

function gui:newDropFrame(name,x, y, w, h, sx ,sy ,sw ,sh)
x,y,w,h,sx,sy,sw,sh=filter(name, x, y, w, h, sx ,sy ,sw ,sh)
local c=self:newBase("DropFrame",name, x, y, w, h, sx ,sy ,sw ,sh)
c.WasBeingDragged=false
c.IsBeingDragged=false
c.Draggable=false
c.funcD={}
function c:GetDroppedItems()
local t=self:getChildren()
local tab={}
for i=1,#t do
if t[i].Type=="TextImageButtonFrameDrag" then
table.insert(tab,t[i])
end
end
return tab
end
function c:OnDropped(func)
table.insert(self.funcD,func)
end
c:OnUpdate(function(self)
if _GuiPro.DragItem then
if _GuiPro.DragItem.Type=="TextImageButtonFrameDrag" and love.mouse.isDown(_GuiPro.DragItem.dragbut or "m")==false and self:IsHovering() then
local t=_GuiPro.DragItem
_GuiPro.DragItem={}
for i=1,#t.funcD do
t.funcD[i](self,t)
end
for i=1,#self.funcD do
self.funcD[i](self,t)
end
_GuiPro.hasDrag=false
end
end
end)
return c
end