testing window/example in ReadMe, is broken

This commit is contained in:
Paul Liverman III 2016-04-03 12:11:27 -07:00
parent dc119e2dc6
commit 3f5cace9b3
6 changed files with 37 additions and 1 deletions

View File

@ -57,7 +57,9 @@ function love.load()
print(b.horizontal, b.vertical) print(b.horizontal, b.vertical)
print(c.horizontal, c.vertical) print(c.horizontal, c.vertical)
--TODO make rounding to nearest pixel DEFAULT BEHAVIOR local window = pop.window():align("center", "center"):setTitle("Welcome!")
--window:addChild(pop.text("Welcome to Pop.Box()!"))
--TODO make debugDraw better --TODO make debugDraw better
end end

View File

@ -21,6 +21,9 @@ do
child.parent = self child.parent = self
return self return self
end, end,
getChildren = function(self)
return self.child
end,
move = function(self, x, y) move = function(self, x, y)
if x then if x then
self.x = self.x + x self.x = self.x + x

View File

@ -44,6 +44,14 @@ do
graphics.print("w", self.x, self.y) graphics.print("w", self.x, self.y)
return self return self
end, end,
addChild = function(self, child)
self.window.child[#self.window.child + 1] = child
child.parent = self.window
return self
end,
getChildren = function(self)
return self.window.child
end,
setSize = function(self, w, h) setSize = function(self, w, h)
local x = 0 local x = 0
local y = 0 local y = 0
@ -109,6 +117,10 @@ do
self.title:move(nil, y) self.title:move(nil, y)
self.window:move(nil, y) self.window:move(nil, y)
return self return self
end,
setTitle = function(self, title)
self.title:setText(title)
return self
end end
} }
_base_0.__index = _base_0 _base_0.__index = _base_0

View File

@ -21,6 +21,9 @@ do
child.parent = self child.parent = self
return self return self
end, end,
getChildren = function(self)
return self.child
end,
move = function(self, x, y) move = function(self, x, y)
if x then if x then
self.x = self.x + x self.x = self.x + x

View File

@ -44,6 +44,14 @@ do
graphics.print("w", self.x, self.y) graphics.print("w", self.x, self.y)
return self return self
end, end,
addChild = function(self, child)
self.window.child[#self.window.child + 1] = child
child.parent = self.window
return self
end,
getChildren = function(self)
return self.window.child
end,
setSize = function(self, w, h) setSize = function(self, w, h)
local x = 0 local x = 0
local y = 0 local y = 0
@ -109,6 +117,10 @@ do
self.title:move(nil, y) self.title:move(nil, y)
self.window:move(nil, y) self.window:move(nil, y)
return self return self
end,
setTitle = function(self, title)
self.title:setText(title)
return self
end end
} }
_base_0.__index = _base_0 _base_0.__index = _base_0

View File

@ -207,3 +207,7 @@ class window extends element
@window\move nil, y @window\move nil, y
return @ return @
setTitle: (title) =>
@title\setText title
return @