diff --git a/demo/main.lua b/demo/main.lua index 0ec2ba5..4d5c0ac 100644 --- a/demo/main.lua +++ b/demo/main.lua @@ -1,4 +1,4 @@ -local pop = require("pop")() +local pop = require "pop" local lg = love.graphics @@ -7,35 +7,35 @@ local testsRun = false local debugDrawEnabled = false 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) --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:element():align("right", "bottom"):setSize(25, 25):move(-5, -5) + 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) end function love.update(dt) - pop:update(dt) + pop.update(dt) end function love.draw() - pop:draw() + pop.draw() if debugDrawEnabled then - pop:debugDraw() + pop.debugDraw() end end function love.textinput(text) - --pop:textinput(text) + pop.textinput(text) end function love.mousepressed(button, x, y) - --pop:mousepressed(button, x, y) + pop.mousepressed(button, x, y) end function love.mousereleased(button, x, y) - --pop:mousereleased(button, x, y) + pop.mousereleased(button, x, y) end function love.keypressed(key) @@ -44,19 +44,19 @@ function love.keypressed(key) else if (key == "s") and (not visualTestsShown) then -- old visual tests - 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("center", "top"):setColor(100, 100, 100) - 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("center", "center"):setSize(90, 90):setColor(255, 255, 255) - 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("center", "bottom"):setColor(255, 255, 0) - 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:text(nil, "Hello World!"):align("center"):setText("Hey, I've been modified!")--:move(0, 18) - pop:text(nil, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()-=_+[]{}\\|:;\"',./<>?`~"):align("center", "bottom") + 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("center", "top"):setColor(100, 100, 100) + 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("center", "center"):setSize(90, 90):setColor(255, 255, 255) + 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("center", "bottom"):setColor(255, 255, 0) + 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.text(nil, "Hello World!"):align("center"):setText("Hey, I've been modified!")--:move(0, 18) + pop.text(nil, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()-=_+[]{}\\|:;\"',./<>?`~"):align("center", "bottom") visualTestsShown = true elseif (key == "t") and (not testsRun) then @@ -65,10 +65,10 @@ function love.keypressed(key) debugDrawEnabled = not debugDrawEnabled end - --pop:keypressed(key) + pop.keypressed(key) end end function love.keyreleased(key) - --pop:keyreleased(key) + pop.keyreleased(key) end diff --git a/demo/pop/init.lua b/demo/pop/init.lua index f9ec126..9c6375b 100644 --- a/demo/pop/init.lua +++ b/demo/pop/init.lua @@ -6,171 +6,139 @@ end local insert insert = table.insert local path = ... -local Pop -do - local _class_0 - local _base_0 = { - create = function(self, elementType, parent, ...) - if parent == nil then - parent = self.window - end - local newElement = self.elements[elementType](parent, ...) - insert(parent.child, newElement) - return newElement - end, - update = function(self, dt, element) - if element == nil then - 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]) +local pop = { } +pop.elements = { } +pop.window = { + child = { } +} +pop.load = function() + local elements = filesystem.getDirectoryItems(tostring(path) .. "/elements") + for i = 1, #elements do + local name = elements[i]:sub(1, -5) + pop.elements[name] = require(tostring(path) .. "/elements/" .. tostring(name)) + print("loaded element: " .. tostring(name)) + if not pop[name] then + pop[name] = function(...) + return pop.create(name, ...) end + print("wrapper created: " .. tostring(name) .. "()") end - } - _base_0.__index = _base_0 - _class_0 = setmetatable({ - __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 + pop.window = pop.create("element"):setSize(graphics.getWidth(), graphics.getHeight()) + return print("created window") 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 diff --git a/lib/pop/init.lua b/lib/pop/init.lua index f9ec126..9c6375b 100644 --- a/lib/pop/init.lua +++ b/lib/pop/init.lua @@ -6,171 +6,139 @@ end local insert insert = table.insert local path = ... -local Pop -do - local _class_0 - local _base_0 = { - create = function(self, elementType, parent, ...) - if parent == nil then - parent = self.window - end - local newElement = self.elements[elementType](parent, ...) - insert(parent.child, newElement) - return newElement - end, - update = function(self, dt, element) - if element == nil then - 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]) +local pop = { } +pop.elements = { } +pop.window = { + child = { } +} +pop.load = function() + local elements = filesystem.getDirectoryItems(tostring(path) .. "/elements") + for i = 1, #elements do + local name = elements[i]:sub(1, -5) + pop.elements[name] = require(tostring(path) .. "/elements/" .. tostring(name)) + print("loaded element: " .. tostring(name)) + if not pop[name] then + pop[name] = function(...) + return pop.create(name, ...) end + print("wrapper created: " .. tostring(name) .. "()") end - } - _base_0.__index = _base_0 - _class_0 = setmetatable({ - __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 + pop.window = pop.create("element"):setSize(graphics.getWidth(), graphics.getHeight()) + return print("created window") 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 diff --git a/src/pop/init.moon b/src/pop/init.moon index f68191e..95c8395 100644 --- a/src/pop/init.moon +++ b/src/pop/init.moon @@ -3,112 +3,106 @@ import insert from table path = ... -class Pop - new: => - @elements = {} - @window = {child: {}} - --@focused = @window --TODO redo better +pop = {} - elements = filesystem.getDirectoryItems "#{path}/elements" - for i = 1, #elements - name = elements[i]\sub 1, -5 - @elements[name] = require "#{path}/elements/#{name}" - print "loaded element: #{name}" +pop.elements = {} +pop.window = {child: {}} --placeholder to allow window creation without specialized code +--pop.focused = false - if not @[name] - @[name] = (...) => return @create(name, ...) - print "wrapper created: #{name}()" +pop.load = -> + elements = filesystem.getDirectoryItems "#{path}/elements" + 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!) - print "created window" - --@window.parent = @window - --@window.parent = false + if not pop[name] + pop[name] = (...) -> return pop.create(name, ...) + print "wrapper created: #{name}()" - create: (elementType, parent=@window, ...) => - newElement = @elements[elementType](parent, ...) - insert parent.child, newElement - return newElement + pop.window = pop.create("element")\setSize(graphics.getWidth!, graphics.getHeight!) + --pop.window.parent = pop.window --may be dangerous? infinite loop looking for the window? + --pop.window.parent = false --may be dangerous? attempting to index a boolean? + print "created window" - update: (dt, element=@window) => - if not element.excludeUpdating - if element.update - element\update dt +pop.create = (elementType, parent=pop.window, ...) -> + newElement = pop.elements[elementType](parent, ...) + insert parent.child, newElement + return newElement - for i = 1, #element.child - @update dt, element.child[i] - - draw: (element=@window) => - 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 +pop.update = (dt, element=pop.window) -> + if not element.excludeUpdating + if element.update + element\update dt 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