2016-02-23 06:10:13 +00:00
|
|
|
local lg = love.graphics
|
2016-03-29 00:59:12 +00:00
|
|
|
local pop
|
2016-02-23 06:10:13 +00:00
|
|
|
|
|
|
|
function love.load()
|
2016-03-29 00:59:12 +00:00
|
|
|
pop = require "pop"
|
|
|
|
local c = pop.box():align("center", "center"):setSize(300, 300)
|
|
|
|
pop.box(c, {255, 0, 0, 255}):setSize(100, 50)
|
|
|
|
pop.box(c, {0, 255, 0, 255}):align("center"):setSize(100, 100)
|
|
|
|
pop.box(c, {0, 0, 255, 255}):align("right"):setSize(50, 100)
|
|
|
|
pop.box(c, {100, 100, 100, 255}):align("center", "center"):setSize(500, 100)
|
|
|
|
pop.box(c):align("center"):setSize(50, 500):move(0, -100)
|
|
|
|
pop.box(c, {255, 255, 0, 255}):align(false, "bottom"):setSize(100, 100)
|
|
|
|
pop.box(c, {255, 150, 0, 255}):align("center", "bottom"):setSize(100, 50)
|
|
|
|
pop.box(c, {0, 255, 255}):align("right", "bottom"):setSize(50, 100):move(-50)
|
|
|
|
pop.text(nil, "Here's some test text\n(with newlines)\nin the top left corner!")
|
|
|
|
pop.text(nil, "Here's some test text in the bottom right corner!"):align("right", "bottom")
|
|
|
|
pop.skin(pop.text("Here's easier-to-code test text in the center!"):align("center", "center", true)) -- 'true' means align to pixel!
|
|
|
|
w = pop.box(nil, {255, 255, 255, 255}):align(false, "bottom"):setSize(150, 150)
|
|
|
|
b = pop.box(w, {0, 0, 0, 255}):setMargin(5):setSize(100, 100)
|
2016-02-23 06:10:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function love.update(dt)
|
2016-02-25 01:02:56 +00:00
|
|
|
pop.update(dt)
|
2016-02-23 06:10:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function love.draw()
|
2016-02-25 01:02:56 +00:00
|
|
|
pop.draw()
|
2016-03-29 00:59:12 +00:00
|
|
|
--pop.debugDraw()
|
2016-02-23 06:10:13 +00:00
|
|
|
end
|
|
|
|
|
2016-03-29 00:59:12 +00:00
|
|
|
function love.mousepressed(x, y, button)
|
|
|
|
pop.mousepressed(x, y, button)
|
2016-02-23 06:10:13 +00:00
|
|
|
end
|
|
|
|
|
2016-03-29 00:59:12 +00:00
|
|
|
function love.mousereleased(x, y, button)
|
|
|
|
pop.mousereleased(x, y, button)
|
2016-02-23 06:10:13 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function love.keypressed(key)
|
2016-03-29 00:59:12 +00:00
|
|
|
local handled = pop.keypressed(key)
|
2016-02-23 06:10:13 +00:00
|
|
|
|
2016-03-29 00:59:12 +00:00
|
|
|
if (key == "escape") and (not handled) then
|
|
|
|
love.event.quit()
|
2016-02-23 06:10:13 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function love.keyreleased(key)
|
2016-02-25 01:02:56 +00:00
|
|
|
pop.keyreleased(key)
|
2016-02-23 06:10:13 +00:00
|
|
|
end
|
2016-03-29 00:59:12 +00:00
|
|
|
|
|
|
|
function love.textinput(text)
|
|
|
|
pop.textinput(text)
|
|
|
|
end
|