diff --git a/gfx/element.lua b/gfx/element.lua index 0884e4f..e56c547 100644 --- a/gfx/element.lua +++ b/gfx/element.lua @@ -5,14 +5,10 @@ local Element = { y = 1, width = 1, height = 1, - color = { - bg = colors.black, - fg = colors.white - }, - render = { - window = nil, - parent = nil - }, + bgColor = colors.black, + fgColor = colors.white, + window = nil, + parent = nil, visible = true, dirty = true, id = "", @@ -31,7 +27,7 @@ function Element:new(o) setmetatable(obj, self) obj.__index = obj - if obj.render and obj.render.parent then + if obj.parent then obj:_reload() end @@ -84,17 +80,17 @@ function Element:setParent(parent) end function Element:setFgColor(color) - if color ~= self.color.fg then + if color ~= self.fgColor then self:setDirty() - self.color.fg = color + self.fgColor = color self.render.window.setTextColor(color) end end function Element:setBgColor(color) - if color ~= self.color.bg then + if color ~= self.bgColor then self:setDirty() - self.color.bg = color + self.bgColor = color self.render.window.setBackgroundColor(color) end end