close #32 #33 excludeDraw / excludeMovement stuff

This commit is contained in:
Paul Liverman III 2016-04-27 12:30:55 -07:00
parent d980e14c1b
commit 61f126cd62
6 changed files with 110 additions and 0 deletions

View File

@ -243,6 +243,20 @@ do
self.parent:removeChild(self) self.parent:removeChild(self)
self = nil self = nil
return nil return nil
end,
getVisibility = function(self)
return (not self.excludeDraw)
end,
setVisibility = function(self, isVisible)
self.excludeDraw = (not isVisible)
return self
end,
getStatic = function(self)
return self.excludeMovement
end,
setStatic = function(self, isStatic)
self.excludeMovement = isStatic
return self
end end
} }
_base_0.__index = _base_0 _base_0.__index = _base_0
@ -262,6 +276,9 @@ do
end end
self.horizontal = "left" self.horizontal = "left"
self.vertical = "top" self.vertical = "top"
self.excludeDraw = false
self.excludeUpdate = false
self.excludeMovement = false
end, end,
__base = _base_0, __base = _base_0,
__name = "element" __name = "element"

View File

@ -52,6 +52,26 @@ element.__base.margin = function(self, m)
end end
end end
element.__base.resize = element.__base.adjustSize element.__base.resize = element.__base.adjustSize
element.__base.visibility = function(self, v)
if v ~= nil then
return self:setVisibility(v)
else
return self:getVisibility()
end
end
element.__base.show = function(self)
return self:setVisibility(true)
end
element.__base.hide = function(self)
return self:setVisibility(false)
end
element.__base.static = function(self, s)
if s ~= nil then
return self:setStatic(s)
else
return self:getStatic()
end
end
box.__base.color = function(self, r, g, b, a) box.__base.color = function(self, r, g, b, a)
if r or g or b or a then if r or g or b or a then
return self:setColor(r, g, b, a) return self:setColor(r, g, b, a)

View File

@ -243,6 +243,20 @@ do
self.parent:removeChild(self) self.parent:removeChild(self)
self = nil self = nil
return nil return nil
end,
getVisibility = function(self)
return (not self.excludeDraw)
end,
setVisibility = function(self, isVisible)
self.excludeDraw = (not isVisible)
return self
end,
getStatic = function(self)
return self.excludeMovement
end,
setStatic = function(self, isStatic)
self.excludeMovement = isStatic
return self
end end
} }
_base_0.__index = _base_0 _base_0.__index = _base_0
@ -262,6 +276,9 @@ do
end end
self.horizontal = "left" self.horizontal = "left"
self.vertical = "top" self.vertical = "top"
self.excludeDraw = false
self.excludeUpdate = false
self.excludeMovement = false
end, end,
__base = _base_0, __base = _base_0,
__name = "element" __name = "element"

View File

@ -52,6 +52,26 @@ element.__base.margin = function(self, m)
end end
end end
element.__base.resize = element.__base.adjustSize element.__base.resize = element.__base.adjustSize
element.__base.visibility = function(self, v)
if v ~= nil then
return self:setVisibility(v)
else
return self:getVisibility()
end
end
element.__base.show = function(self)
return self:setVisibility(true)
end
element.__base.hide = function(self)
return self:setVisibility(false)
end
element.__base.static = function(self, s)
if s ~= nil then
return self:setStatic(s)
else
return self:getStatic()
end
end
box.__base.color = function(self, r, g, b, a) box.__base.color = function(self, r, g, b, a)
if r or g or b or a then if r or g or b or a then
return self:setColor(r, g, b, a) return self:setColor(r, g, b, a)

View File

@ -28,6 +28,10 @@ class element
@horizontal = "left" @horizontal = "left"
@vertical = "top" @vertical = "top"
@excludeDraw = false
@excludeUpdate = false
@excludeMovement = false
debugDraw: => debugDraw: =>
graphics.setLineWidth 0.5 graphics.setLineWidth 0.5
graphics.setColor 0, 0, 0, 100 graphics.setColor 0, 0, 0, 100
@ -267,3 +271,17 @@ class element
@parent\removeChild @ @parent\removeChild @
@ = nil @ = nil
return nil return nil
getVisibility: =>
return (not @excludeDraw)
setVisibility: (isVisible) =>
@excludeDraw = (not isVisible)
return @
getStatic: =>
return @excludeMovement
setStatic: (isStatic) =>
@excludeMovement = isStatic
return @

View File

@ -47,6 +47,24 @@ element.__base.margin = (m) =>
element.__base.resize = element.__base.adjustSize element.__base.resize = element.__base.adjustSize
element.__base.visibility = (v) =>
if v != nil
return @setVisibility v
else
return @getVisibility!
element.__base.show = =>
return @setVisibility true
element.__base.hide = =>
return @setVisibility false
element.__base.static = (s) =>
if s != nil
return @setStatic s
else
return @getStatic!
-- box.__base.background -- can't be done! -- box.__base.background -- can't be done!
box.__base.color = (r, g, b, a) => box.__base.color = (r, g, b, a) =>