Ryan Ward 89b4901e06 Love2d support is updated to 11.1
May be bugs in supporting libraries, but the multitasking library is fully updated.

The guimanager may have a bug or 2, but I haven't found any ground breaking bugs that haven't been fixed
2018-06-08 22:14:21 -04:00

41 lines
1.0 KiB
Plaintext

if love.filesystem.getInfo("CheckBoxes.png") then
_GuiPro.UC=gui:getTile("CheckBoxes.png",0,0,16,16)
_GuiPro.C=gui:getTile("CheckBoxes.png",16,0,16,16)
_GuiPro.UCH=gui:getTile("CheckBoxes.png",0,16,16,16)
_GuiPro.CH=gui:getTile("CheckBoxes.png",16,16,16,16)
end
function gui:newCheckBox(name,x,y)
if not(_GuiPro.UC) then error("CheckBoxes.png not found! Cannot currently use checkbox without the data") end
if type(name)~="String" then
x,y,name=name,x,"CheckBox"
end
local c=self:newImageLabel(_GuiPro.UC,name, x, y, 16,16)
c.Visibility=0
c.check=false
c:OnEnter(function(self)
if self.check then
self:SetImage(_GuiPro.CH)
else
self:SetImage(_GuiPro.UCH)
end
end)
function c:isChecked()
return self.check
end
c:OnExit(function(self)
if self.check then
self:SetImage(_GuiPro.C)
else
self:SetImage(_GuiPro.UC)
end
end)
c:OnReleased(function(b,self)
self.check=not(self.check)
if self.check then
self:SetImage(_GuiPro.CH)
else
self:SetImage(_GuiPro.UCH)
end
end)
return c
end