Files
Basalt/source/objects/Switch.lua
2022-06-03 01:34:50 -04:00

40 lines
1.0 KiB
Lua

local function Switch(name)
local base = Object(name)
local objectType = "Switch"
base.width = 3
base.height = 1
base.bgColor = colors.lightGray
base.fgColor = colors.gray
base:setValue(false)
base:setZIndex(5)
local object = {
getType = function(self)
return objectType
end;
mouseClickHandler = function(self, event, button, x, y)
if (base.mouseClickHandler(self, event, button, x, y)) then
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
if (((event == "mouse_click") or (event == "mouse_drag")) and (button == 1))or(event=="monitor_touch") then
end
return true
end
end;
draw = function(self)
if (base.draw(self)) then
if (self.parent ~= nil) then
local obx, oby = self:getAnchorPosition()
end
end
end;
}
return setmetatable(object, base)
end