another fix attempt, failed

This commit is contained in:
Fox 2016-02-24 17:02:56 -08:00
parent 79130fe3d6
commit a5e3714af8
4 changed files with 386 additions and 456 deletions

View File

@ -1,4 +1,4 @@
local pop = require("pop")() local pop = require "pop"
local lg = love.graphics local lg = love.graphics
@ -7,35 +7,35 @@ local testsRun = false
local debugDrawEnabled = false local debugDrawEnabled = false
function love.load() function love.load()
pop:text(nil, "Press \"s\" to show objects for visual testing/demo.\nPress \"t\" to run tests.\nPress \"d\" to toggle debug draw."):move(2, 2) pop.text(nil, "Press \"s\" to show objects for visual testing/demo.\nPress \"t\" to run tests.\nPress \"d\" to toggle debug draw."):move(2, 2)
--TODO correct the fact that the size is wrong here! (height doesn't take into account \n) --TODO correct the fact that the size is wrong here! (height doesn't take into account \n)
--NOTE width? Is width calculated correctly when \n's exist? TEST THIS (also test tabs) --NOTE width? Is width calculated correctly when \n's exist? TEST THIS (also test tabs)
pop:text(nil, "This is a test\ncollection of strings to see how width is determined.\nLooks like it takes width of widest line!"):move(30, 120) pop.text(nil, "This is a test\ncollection of strings to see how width is determined.\nLooks like it takes width of widest line!"):move(30, 120)
pop:element():align("right", "bottom"):setSize(25, 25):move(-5, -5) pop.element():align("right", "bottom"):setSize(25, 25):move(-5, -5)
end end
function love.update(dt) function love.update(dt)
pop:update(dt) pop.update(dt)
end end
function love.draw() function love.draw()
pop:draw() pop.draw()
if debugDrawEnabled then if debugDrawEnabled then
pop:debugDraw() pop.debugDraw()
end end
end end
function love.textinput(text) function love.textinput(text)
--pop:textinput(text) pop.textinput(text)
end end
function love.mousepressed(button, x, y) function love.mousepressed(button, x, y)
--pop:mousepressed(button, x, y) pop.mousepressed(button, x, y)
end end
function love.mousereleased(button, x, y) function love.mousereleased(button, x, y)
--pop:mousereleased(button, x, y) pop.mousereleased(button, x, y)
end end
function love.keypressed(key) function love.keypressed(key)
@ -44,19 +44,19 @@ function love.keypressed(key)
else else
if (key == "s") and (not visualTestsShown) then if (key == "s") and (not visualTestsShown) then
-- old visual tests -- old visual tests
local align = pop:box():align("center", "center"):setSize(200, 200) local align = pop.box():align("center", "center"):setSize(200, 200)
pop:box(align):align("left", "top"):setSize(75, 10):setColor(255, 0, 255, 255) pop.box(align):align("left", "top"):setSize(75, 10):setColor(255, 0, 255, 255)
pop:box(align):align("center", "top"):setColor(100, 100, 100) pop.box(align):align("center", "top"):setColor(100, 100, 100)
pop:box(align, {0, 255, 0, 255}):setSize(20, 5):align("right", "top") pop.box(align, {0, 255, 0, 255}):setSize(20, 5):align("right", "top")
pop:box(align):align("left", "center"):setColor(0, 0, 255) pop.box(align):align("left", "center"):setColor(0, 0, 255)
pop:box(align):align("center", "center"):setSize(90, 90):setColor(255, 255, 255) pop.box(align):align("center", "center"):setSize(90, 90):setColor(255, 255, 255)
pop:box(align):align("right", "center"):setColor(255, 0, 0) pop.box(align):align("right", "center"):setColor(255, 0, 0)
pop:box(align):align("left", "bottom"):setColor(0, 255, 0):setSize(nil, 40) pop.box(align):align("left", "bottom"):setColor(0, 255, 0):setSize(nil, 40)
pop:box(align):align("center", "bottom"):setColor(255, 255, 0) pop.box(align):align("center", "bottom"):setColor(255, 255, 0)
pop:box(align):align("right", "bottom"):setColor(0, 255, 255):setSize(40, 40) pop.box(align):align("right", "bottom"):setColor(0, 255, 255):setSize(40, 40)
--pop:box(nil, {255, 0, 0, 255}):align("left", "top"):setSize(50, 50) --TODO adjust z-height of elements --pop.box(nil, {255, 0, 0, 255}):align("left", "top"):setSize(50, 50) --TODO adjust z-height of elements
pop:text(nil, "Hello World!"):align("center"):setText("Hey, I've been modified!")--:move(0, 18) pop.text(nil, "Hello World!"):align("center"):setText("Hey, I've been modified!")--:move(0, 18)
pop:text(nil, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()-=_+[]{}\\|:;\"',./<>?`~"):align("center", "bottom") pop.text(nil, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()-=_+[]{}\\|:;\"',./<>?`~"):align("center", "bottom")
visualTestsShown = true visualTestsShown = true
elseif (key == "t") and (not testsRun) then elseif (key == "t") and (not testsRun) then
@ -65,10 +65,10 @@ function love.keypressed(key)
debugDrawEnabled = not debugDrawEnabled debugDrawEnabled = not debugDrawEnabled
end end
--pop:keypressed(key) pop.keypressed(key)
end end
end end
function love.keyreleased(key) function love.keyreleased(key)
--pop:keyreleased(key) pop.keyreleased(key)
end end

View File

@ -6,171 +6,139 @@ end
local insert local insert
insert = table.insert insert = table.insert
local path = ... local path = ...
local Pop local pop = { }
do pop.elements = { }
local _class_0 pop.window = {
local _base_0 = { child = { }
create = function(self, elementType, parent, ...) }
if parent == nil then pop.load = function()
parent = self.window local elements = filesystem.getDirectoryItems(tostring(path) .. "/elements")
end for i = 1, #elements do
local newElement = self.elements[elementType](parent, ...) local name = elements[i]:sub(1, -5)
insert(parent.child, newElement) pop.elements[name] = require(tostring(path) .. "/elements/" .. tostring(name))
return newElement print("loaded element: " .. tostring(name))
end, if not pop[name] then
update = function(self, dt, element) pop[name] = function(...)
if element == nil then return pop.create(name, ...)
element = self.window
end
if not element.excludeUpdating then
if element.update then
element:update(dt)
end
for i = 1, #element.child do
self:update(dt, element.child[i])
end
end
end,
draw = function(self, element)
if element == nil then
element = self.window
end
if not element.excludeRendering then
if element.draw then
local _
do
local _base_1 = element
local _fn_0 = _base_1.draw
_ = function(...)
return _fn_0(_base_1, ...)
end
end
end
for i = 1, #element.child do
self:draw(element.child[i])
end
end
end,
mousepressed = function(self, button, x, y, element)
if element == nil then
element = self.window
end
if (x >= element.x) and (x <= (element.x + element.w)) then
if (y >= element.y) and (y <= (element.y + element.h)) then
for i = 1, #element.child do
if self:mousepressed(button, x, y, element.child[i]) then
return true
end
end
if element.mousepressed then
return element:mousepressed(button, x - element.x, y - element.y)
else
return false
end
end
end
end,
mousereleased = function(self, button, x, y, element)
if element == nil then
element = self.window
end
if (x >= element.x) and (x <= (element.x + element.w)) then
if (y >= element.y) and (y <= (element.y + element.h)) then
for i = 1, #element.child do
if self:mousereleased(button, x, y, element.child[i]) then
return true
end
end
if element.mousereleased then
return element:mousereleased(button, x - element.x, y - element.y)
else
return false
end
end
end
end,
keypressed = function(self, key)
return error("Unimplemented.")
end,
keyreleased = function(self, key)
return error("Unimplemented.")
end,
textinput = function(self, text)
return error("Unimplemented.")
end,
skin = function(self, element, skin, apply_to_children)
if apply_to_children == nil then
apply_to_children = true
end
element.margin = skin.margin
if element.background then
element.background = skin.background
end
if element.color then
element.color = skin.color
end
if element.font then
element.font = skin.font
end
if apply_to_children then
for i = 1, #element.child do
self:skin(element.child[i], skin)
end
end
end,
debugDraw = function(self, element)
if element == nil then
element = self.window
end
if element.debugDraw then
element:debugDraw()
else
graphics.setLineWidth(1)
graphics.setColor(0, 0, 0, 100)
graphics.rectangle("fill", element.x, element.y, element.w, element.h)
graphics.setColor(150, 150, 150, 150)
graphics.rectangle("line", element.x, element.y, element.w, element.h)
graphics.setColor(200, 200, 200, 255)
graphics.print(".", element.x, element.y)
end
for i = 1, #element.child do
self:debugDraw(element.child[i])
end end
print("wrapper created: " .. tostring(name) .. "()")
end end
} end
_base_0.__index = _base_0 pop.window = pop.create("element"):setSize(graphics.getWidth(), graphics.getHeight())
_class_0 = setmetatable({ return print("created window")
__init = function(self)
self.elements = { }
self.window = {
child = { }
}
local elements = filesystem.getDirectoryItems(tostring(path) .. "/elements")
for i = 1, #elements do
local name = elements[i]:sub(1, -5)
self.elements[name] = require(tostring(path) .. "/elements/" .. tostring(name))
print("loaded element: " .. tostring(name))
if not self[name] then
self[name] = function(self, ...)
return self:create(name, ...)
end
print("wrapper created: " .. tostring(name) .. "()")
end
end
self.window = self:create("element", self.window):setSize(graphics.getWidth(), graphics.getHeight())
return print("created window")
end,
__base = _base_0,
__name = "Pop"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
Pop = _class_0
return _class_0
end end
pop.create = function(elementType, parent, ...)
if parent == nil then
parent = pop.window
end
local newElement = pop.elements[elementType](parent, ...)
insert(parent.child, newElement)
return newElement
end
pop.update = function(dt, element)
if element == nil then
element = pop.window
end
if not element.excludeUpdating then
if element.update then
element:update(dt)
end
for i = 1, #element.child do
pop.update(dt, element.child[i])
end
end
end
pop.draw = function(element)
if element == nil then
element = pop.window
end
if not element.excludeRendering then
if element.draw then
local _
do
local _base_0 = element
local _fn_0 = _base_0.draw
_ = function(...)
return _fn_0(_base_0, ...)
end
end
end
for i = 1, #element.child do
pop.draw(element.child)
end
end
end
pop.mousepressed = function(button, x, y, element)
if element == nil then
element = pop.window
end
if (x >= element.x) and (x <= (element.x + element.w)) then
if (y >= element.y) and (y <= (element.y + element.h)) then
for i = 1, #element.child do
if pop.mousepressed(button, x, y, element.child[i]) then
return true
end
end
if element.mousepressed then
return element:mousepressed(button, x - element.x, y - element.y)
else
return false
end
end
end
end
pop.mousereleased = function(button, x, y, element)
if element == nil then
element = pop.window
end
end
pop.keypressed = function(key)
return print("pop.keypressed() is unimplemented.")
end
pop.keyreleased = function(key)
return print("pop.keyreleased() is unimplemented.")
end
pop.textinput = function(text)
return print("pop.textinput() is unimplemented.")
end
pop.skin = function(element, skin, apply_to_children)
if apply_to_children == nil then
apply_to_children = true
end
element.margin = skin.margin
if element.background then
element.background = skin.background
end
if element.color then
element.color = skin.color
end
if element.font then
element.font = skin.font
end
if apply_to_children then
for i = 1, #element.child do
pop.skin(element.child[i], skin)
end
end
end
pop.debugDraw = function(element)
if element == nil then
element = pop.window
end
if element.debugDraw then
element:debugDraw()
else
graphics.setLineWidth(1)
graphics.setColor(0, 0, 0, 100)
graphics.rectangle("fill", element.x, element.y, element.w, element.h)
graphics.setColor(150, 150, 150, 150)
graphics.rectangle("line", element.x, element.y, element.w, element.h)
graphics.setColor(200, 200, 200, 255)
graphics.print(".", element.x, element.y)
end
for i = 1, #element.child do
pop.debugDraw(element.child[i])
end
end
pop.load()
return pop

View File

@ -6,171 +6,139 @@ end
local insert local insert
insert = table.insert insert = table.insert
local path = ... local path = ...
local Pop local pop = { }
do pop.elements = { }
local _class_0 pop.window = {
local _base_0 = { child = { }
create = function(self, elementType, parent, ...) }
if parent == nil then pop.load = function()
parent = self.window local elements = filesystem.getDirectoryItems(tostring(path) .. "/elements")
end for i = 1, #elements do
local newElement = self.elements[elementType](parent, ...) local name = elements[i]:sub(1, -5)
insert(parent.child, newElement) pop.elements[name] = require(tostring(path) .. "/elements/" .. tostring(name))
return newElement print("loaded element: " .. tostring(name))
end, if not pop[name] then
update = function(self, dt, element) pop[name] = function(...)
if element == nil then return pop.create(name, ...)
element = self.window
end
if not element.excludeUpdating then
if element.update then
element:update(dt)
end
for i = 1, #element.child do
self:update(dt, element.child[i])
end
end
end,
draw = function(self, element)
if element == nil then
element = self.window
end
if not element.excludeRendering then
if element.draw then
local _
do
local _base_1 = element
local _fn_0 = _base_1.draw
_ = function(...)
return _fn_0(_base_1, ...)
end
end
end
for i = 1, #element.child do
self:draw(element.child[i])
end
end
end,
mousepressed = function(self, button, x, y, element)
if element == nil then
element = self.window
end
if (x >= element.x) and (x <= (element.x + element.w)) then
if (y >= element.y) and (y <= (element.y + element.h)) then
for i = 1, #element.child do
if self:mousepressed(button, x, y, element.child[i]) then
return true
end
end
if element.mousepressed then
return element:mousepressed(button, x - element.x, y - element.y)
else
return false
end
end
end
end,
mousereleased = function(self, button, x, y, element)
if element == nil then
element = self.window
end
if (x >= element.x) and (x <= (element.x + element.w)) then
if (y >= element.y) and (y <= (element.y + element.h)) then
for i = 1, #element.child do
if self:mousereleased(button, x, y, element.child[i]) then
return true
end
end
if element.mousereleased then
return element:mousereleased(button, x - element.x, y - element.y)
else
return false
end
end
end
end,
keypressed = function(self, key)
return error("Unimplemented.")
end,
keyreleased = function(self, key)
return error("Unimplemented.")
end,
textinput = function(self, text)
return error("Unimplemented.")
end,
skin = function(self, element, skin, apply_to_children)
if apply_to_children == nil then
apply_to_children = true
end
element.margin = skin.margin
if element.background then
element.background = skin.background
end
if element.color then
element.color = skin.color
end
if element.font then
element.font = skin.font
end
if apply_to_children then
for i = 1, #element.child do
self:skin(element.child[i], skin)
end
end
end,
debugDraw = function(self, element)
if element == nil then
element = self.window
end
if element.debugDraw then
element:debugDraw()
else
graphics.setLineWidth(1)
graphics.setColor(0, 0, 0, 100)
graphics.rectangle("fill", element.x, element.y, element.w, element.h)
graphics.setColor(150, 150, 150, 150)
graphics.rectangle("line", element.x, element.y, element.w, element.h)
graphics.setColor(200, 200, 200, 255)
graphics.print(".", element.x, element.y)
end
for i = 1, #element.child do
self:debugDraw(element.child[i])
end end
print("wrapper created: " .. tostring(name) .. "()")
end end
} end
_base_0.__index = _base_0 pop.window = pop.create("element"):setSize(graphics.getWidth(), graphics.getHeight())
_class_0 = setmetatable({ return print("created window")
__init = function(self)
self.elements = { }
self.window = {
child = { }
}
local elements = filesystem.getDirectoryItems(tostring(path) .. "/elements")
for i = 1, #elements do
local name = elements[i]:sub(1, -5)
self.elements[name] = require(tostring(path) .. "/elements/" .. tostring(name))
print("loaded element: " .. tostring(name))
if not self[name] then
self[name] = function(self, ...)
return self:create(name, ...)
end
print("wrapper created: " .. tostring(name) .. "()")
end
end
self.window = self:create("element", self.window):setSize(graphics.getWidth(), graphics.getHeight())
return print("created window")
end,
__base = _base_0,
__name = "Pop"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
Pop = _class_0
return _class_0
end end
pop.create = function(elementType, parent, ...)
if parent == nil then
parent = pop.window
end
local newElement = pop.elements[elementType](parent, ...)
insert(parent.child, newElement)
return newElement
end
pop.update = function(dt, element)
if element == nil then
element = pop.window
end
if not element.excludeUpdating then
if element.update then
element:update(dt)
end
for i = 1, #element.child do
pop.update(dt, element.child[i])
end
end
end
pop.draw = function(element)
if element == nil then
element = pop.window
end
if not element.excludeRendering then
if element.draw then
local _
do
local _base_0 = element
local _fn_0 = _base_0.draw
_ = function(...)
return _fn_0(_base_0, ...)
end
end
end
for i = 1, #element.child do
pop.draw(element.child)
end
end
end
pop.mousepressed = function(button, x, y, element)
if element == nil then
element = pop.window
end
if (x >= element.x) and (x <= (element.x + element.w)) then
if (y >= element.y) and (y <= (element.y + element.h)) then
for i = 1, #element.child do
if pop.mousepressed(button, x, y, element.child[i]) then
return true
end
end
if element.mousepressed then
return element:mousepressed(button, x - element.x, y - element.y)
else
return false
end
end
end
end
pop.mousereleased = function(button, x, y, element)
if element == nil then
element = pop.window
end
end
pop.keypressed = function(key)
return print("pop.keypressed() is unimplemented.")
end
pop.keyreleased = function(key)
return print("pop.keyreleased() is unimplemented.")
end
pop.textinput = function(text)
return print("pop.textinput() is unimplemented.")
end
pop.skin = function(element, skin, apply_to_children)
if apply_to_children == nil then
apply_to_children = true
end
element.margin = skin.margin
if element.background then
element.background = skin.background
end
if element.color then
element.color = skin.color
end
if element.font then
element.font = skin.font
end
if apply_to_children then
for i = 1, #element.child do
pop.skin(element.child[i], skin)
end
end
end
pop.debugDraw = function(element)
if element == nil then
element = pop.window
end
if element.debugDraw then
element:debugDraw()
else
graphics.setLineWidth(1)
graphics.setColor(0, 0, 0, 100)
graphics.rectangle("fill", element.x, element.y, element.w, element.h)
graphics.setColor(150, 150, 150, 150)
graphics.rectangle("line", element.x, element.y, element.w, element.h)
graphics.setColor(200, 200, 200, 255)
graphics.print(".", element.x, element.y)
end
for i = 1, #element.child do
pop.debugDraw(element.child[i])
end
end
pop.load()
return pop

View File

@ -3,112 +3,106 @@ import insert from table
path = ... path = ...
class Pop pop = {}
new: =>
@elements = {}
@window = {child: {}}
--@focused = @window --TODO redo better
elements = filesystem.getDirectoryItems "#{path}/elements" pop.elements = {}
for i = 1, #elements pop.window = {child: {}} --placeholder to allow window creation without specialized code
name = elements[i]\sub 1, -5 --pop.focused = false
@elements[name] = require "#{path}/elements/#{name}"
print "loaded element: #{name}"
if not @[name] pop.load = ->
@[name] = (...) => return @create(name, ...) elements = filesystem.getDirectoryItems "#{path}/elements"
print "wrapper created: #{name}()" for i = 1, #elements
name = elements[i]\sub 1, -5
pop.elements[name] = require "#{path}/elements/#{name}"
print "loaded element: #{name}"
@window = @create("element", @window)\setSize(graphics.getWidth!, graphics.getHeight!) if not pop[name]
print "created window" pop[name] = (...) -> return pop.create(name, ...)
--@window.parent = @window print "wrapper created: #{name}()"
--@window.parent = false
create: (elementType, parent=@window, ...) => pop.window = pop.create("element")\setSize(graphics.getWidth!, graphics.getHeight!)
newElement = @elements[elementType](parent, ...) --pop.window.parent = pop.window --may be dangerous? infinite loop looking for the window?
insert parent.child, newElement --pop.window.parent = false --may be dangerous? attempting to index a boolean?
return newElement print "created window"
update: (dt, element=@window) => pop.create = (elementType, parent=pop.window, ...) ->
if not element.excludeUpdating newElement = pop.elements[elementType](parent, ...)
if element.update insert parent.child, newElement
element\update dt return newElement
for i = 1, #element.child pop.update = (dt, element=pop.window) ->
@update dt, element.child[i] if not element.excludeUpdating
if element.update
draw: (element=@window) => element\update dt
if not element.excludeRendering
if element.draw
element\draw
for i = 1, #element.child
@draw element.child[i]
mousepressed: (button, x, y, element=@window) =>
-- if within bounds of element, check its children
-- if not handled by child, check if it can handle it
-- abort loop with success if handled
if (x >= element.x) and (x <= (element.x + element.w))
if (y >= element.y) and (y <= (element.y + element.h))
for i = 1, #element.child
if @mousepressed button, x, y, element.child[i]
return true
if element.mousepressed
return element\mousepressed button, x - element.x, y - element.y
else
return false
--TODO rewrite for multiple return values, mousereleased is the first val, click is the second!
mousereleased: (button, x, y, element=@window) =>
-- same as mousepressed, except an additional click is fired
-- (TODO fix, so you have to start and end the click on the same element)
if (x >= element.x) and (x <= (element.x + element.w))
if (y >= element.y) and (y <= (element.y + element.h))
for i = 1, #element.child
if @mousereleased button, x, y, element.child[i]
return true
if element.mousereleased
return element\mousereleased button, x - element.x, y - element.y
else
return false
keypressed: (key) =>
error "Unimplemented."
keyreleased: (key) =>
error "Unimplemented."
textinput: (text) =>
error "Unimplemented."
skin: (element, skin, apply_to_children=true) =>
element.margin = skin.margin
if element.background
element.background = skin.background
if element.color
element.color = skin.color
if element.font
element.font = skin.font
if apply_to_children
for i = 1, #element.child
@skin element.child[i], skin
debugDraw: (element=@window) =>
if element.debugDraw
element\debugDraw!
else
graphics.setLineWidth 1
graphics.setColor 0, 0, 0, 100
graphics.rectangle "fill", element.x, element.y, element.w, element.h
graphics.setColor 150, 150, 150, 150
graphics.rectangle "line", element.x, element.y, element.w, element.h
graphics.setColor 200, 200, 200, 255
graphics.print ".", element.x, element.y
for i = 1, #element.child for i = 1, #element.child
@debugDraw element.child[i] pop.update dt, element.child[i]
pop.draw = (element=pop.window) ->
if not element.excludeRendering
if element.draw
element\draw
for i = 1, #element.child
pop.draw element.child
pop.mousepressed = (button, x, y, element=pop.window) ->
-- if within bounds, check children
-- if not handled, check if we can handle it
-- abort with success if handled
if (x >= element.x) and (x <= (element.x + element.w))
if (y >= element.y) and (y <= (element.y + element.h))
for i = 1, #element.child
if pop.mousepressed button, x, y, element.child[i]
return true
if element.mousepressed
return element\mousepressed button, x - element.x, y - element.y
else
return false
--TODO multiple return values, mousereleased first, click second
pop.mousereleased = (button, x, y, element=pop.window) ->
-- same as mousepressed, except a click can be fired as well
pop.keypressed = (key) ->
print "pop.keypressed() is unimplemented."
pop.keyreleased = (key) ->
print "pop.keyreleased() is unimplemented."
pop.textinput = (text) ->
print "pop.textinput() is unimplemented."
pop.skin = (element, skin, apply_to_children=true) ->
element.margin = skin.margin
if element.background
element.background = skin.background
if element.color
element.color = skin.color
if element.font
element.font = skin.font
if apply_to_children
for i = 1, #element.child
pop.skin element.child[i], skin
pop.debugDraw = (element=pop.window) ->
if element.debugDraw
element\debugDraw!
else
graphics.setLineWidth 1
graphics.setColor 0, 0, 0, 100
graphics.rectangle "fill", element.x, element.y, element.w, element.h
graphics.setColor 150, 150, 150, 150
graphics.rectangle "line", element.x, element.y, element.w, element.h
graphics.setColor 200, 200, 200, 255
graphics.print ".", element.x, element.y
for i = 1, #element.child
pop.debugDraw element.child[i]
pop.load!
return pop