2017-05-11 21:47:33 +00:00
|
|
|
local graphics
|
|
|
|
graphics = love.graphics
|
2016-08-21 05:29:16 +00:00
|
|
|
local pop = require("")
|
2017-04-30 21:13:56 +00:00
|
|
|
local debug = false
|
|
|
|
love.load = function()
|
2017-08-28 06:40:09 +00:00
|
|
|
local test_original
|
|
|
|
test_original = function()
|
2017-05-11 21:47:33 +00:00
|
|
|
pop.text("Hello World!"):align("center", "center")
|
|
|
|
local testWindow = pop.window({
|
|
|
|
windowBackground = {
|
|
|
|
200,
|
|
|
|
200,
|
|
|
|
200
|
|
|
|
},
|
|
|
|
closeable = true,
|
|
|
|
maximizeable = true,
|
|
|
|
minimizeable = true
|
|
|
|
}, "Testing Window"):move(20, 20):setSize(200, 100):align("right", "top")
|
|
|
|
print(testWindow.window_area)
|
|
|
|
pop.window({
|
|
|
|
maximizeable = true
|
|
|
|
}, "Test Window #2"):align("center", "bottom")
|
2017-08-14 01:59:18 +00:00
|
|
|
pop.window({
|
|
|
|
moveable = false
|
|
|
|
}, "Immoveable!")
|
2017-05-11 21:47:33 +00:00
|
|
|
local centerBox = pop.box({
|
|
|
|
w = 200,
|
|
|
|
h = 200
|
|
|
|
}, {
|
2017-04-30 21:13:56 +00:00
|
|
|
255,
|
|
|
|
255,
|
|
|
|
0,
|
2017-05-11 21:47:33 +00:00
|
|
|
120
|
|
|
|
}):align("center", "center")
|
|
|
|
pop.box(centerBox, {
|
|
|
|
w = 10,
|
|
|
|
h = 20
|
|
|
|
}):align("left", "top")
|
|
|
|
pop.box(centerBox, {
|
|
|
|
w = 30,
|
|
|
|
h = 30
|
|
|
|
}):align("center", "top")
|
|
|
|
pop.box(centerBox, {
|
|
|
|
w = 5,
|
|
|
|
h = 40
|
|
|
|
}):align("left", "center")
|
|
|
|
pop.box(centerBox, {
|
|
|
|
w = 50,
|
|
|
|
h = 50
|
|
|
|
}):align("right", "center")
|
|
|
|
pop.box(centerBox):align("left", "bottom"):setSize(5, 5)
|
|
|
|
pop.box(centerBox, {
|
|
|
|
w = 25,
|
|
|
|
h = 10
|
|
|
|
}):align("center", "bottom")
|
|
|
|
pop.text(centerBox, "Align me!"):align("right", "top")
|
2017-08-14 01:15:08 +00:00
|
|
|
pop.window(centerBox, {
|
|
|
|
closeable = true
|
|
|
|
}):align("right", "bottom")
|
2017-05-11 21:47:33 +00:00
|
|
|
centerBox:setPadding(5)
|
|
|
|
pop.box(centerBox, {
|
|
|
|
w = 10,
|
|
|
|
h = 20,
|
|
|
|
background = {
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
255,
|
|
|
|
100
|
|
|
|
}
|
|
|
|
}):align("left", "top")
|
|
|
|
pop.box(centerBox, {
|
|
|
|
w = 30,
|
|
|
|
h = 30,
|
|
|
|
background = {
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
255,
|
|
|
|
100
|
|
|
|
}
|
|
|
|
}):align("center", "top")
|
|
|
|
pop.box(centerBox, {
|
|
|
|
w = 5,
|
|
|
|
h = 40,
|
|
|
|
background = {
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
255,
|
|
|
|
100
|
|
|
|
}
|
|
|
|
}):align("left", "center")
|
|
|
|
pop.box(centerBox, {
|
|
|
|
w = 50,
|
|
|
|
h = 50,
|
|
|
|
background = {
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
255,
|
|
|
|
100
|
|
|
|
}
|
|
|
|
}):align("right", "center")
|
|
|
|
pop.text(centerBox, {
|
|
|
|
color = {
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
255,
|
|
|
|
100
|
|
|
|
}
|
|
|
|
}, "Text!"):align("left", "bottom")
|
|
|
|
pop.box(centerBox, {
|
|
|
|
w = 25,
|
|
|
|
h = 10,
|
|
|
|
background = {
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
255,
|
|
|
|
100
|
|
|
|
}
|
|
|
|
}):align("center", "bottom")
|
|
|
|
pop.text(centerBox, {
|
|
|
|
color = {
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
255,
|
|
|
|
100
|
|
|
|
}
|
|
|
|
}, "Align me!"):align("right", "top")
|
2017-08-14 01:15:08 +00:00
|
|
|
pop.window(centerBox, {
|
2017-05-11 21:47:33 +00:00
|
|
|
titleColor = {
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
150
|
|
|
|
},
|
|
|
|
titleBackground = {
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
255,
|
|
|
|
100
|
|
|
|
},
|
|
|
|
windowBackground = {
|
|
|
|
200,
|
|
|
|
200,
|
|
|
|
255,
|
|
|
|
100
|
|
|
|
}
|
|
|
|
}):align("right", "bottom")
|
2017-08-14 01:15:08 +00:00
|
|
|
pop.window(centerBox, {
|
|
|
|
containMethod = "title",
|
|
|
|
w = 125
|
|
|
|
}, "Title can't leave")
|
|
|
|
return pop.window(centerBox, {
|
|
|
|
containMethod = "body",
|
|
|
|
w = 125
|
|
|
|
}, "Body can't leave")
|
2017-05-11 21:47:33 +00:00
|
|
|
end
|
2017-08-28 06:40:09 +00:00
|
|
|
local test_obession
|
|
|
|
test_obession = function()
|
2017-05-11 21:47:33 +00:00
|
|
|
local partsGrid = pop.dynamicGrid()
|
|
|
|
return pop.window({
|
|
|
|
w = graphics.getWidth() / 2,
|
|
|
|
h = graphics.getHeight(),
|
|
|
|
titleBar = false
|
|
|
|
}):add({
|
|
|
|
pop.box({
|
|
|
|
h = 17
|
|
|
|
}),
|
|
|
|
pop.scrollbox():add(partsGrid),
|
|
|
|
pop.grid():add({
|
|
|
|
pop.button(),
|
|
|
|
pop.button(),
|
|
|
|
pop.button()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
end
|
2017-08-28 06:40:09 +00:00
|
|
|
return test_original()
|
2017-04-30 21:13:56 +00:00
|
|
|
end
|
2017-04-30 23:40:29 +00:00
|
|
|
love.update = function(dt)
|
|
|
|
return pop.update(dt)
|
|
|
|
end
|
2017-01-10 20:57:02 +00:00
|
|
|
love.draw = function()
|
2017-04-30 21:13:56 +00:00
|
|
|
pop.draw()
|
|
|
|
if debug then
|
|
|
|
return pop.debugDraw()
|
|
|
|
end
|
2017-01-10 20:57:02 +00:00
|
|
|
end
|
2017-04-30 23:40:29 +00:00
|
|
|
love.mousemoved = function(x, y, dx, dy)
|
|
|
|
return pop.mousemoved(x, y, dx, dy)
|
|
|
|
end
|
|
|
|
love.mousepressed = function(x, y, button)
|
|
|
|
return pop.mousepressed(x, y, button)
|
|
|
|
end
|
|
|
|
love.mousereleased = function(x, y, button)
|
|
|
|
return pop.mousereleased(x, y, button)
|
|
|
|
end
|
|
|
|
love.wheelmoved = function(x, y)
|
|
|
|
return pop.wheelmoved(x, y)
|
|
|
|
end
|
2017-01-10 20:57:02 +00:00
|
|
|
love.keypressed = function(key)
|
|
|
|
if key == "escape" then
|
|
|
|
return love.event.quit()
|
2017-04-30 21:13:56 +00:00
|
|
|
elseif key == "d" then
|
|
|
|
debug = not debug
|
2017-08-14 01:50:54 +00:00
|
|
|
elseif key == "t" then
|
|
|
|
return print("pop.focused", pop.focused)
|
2017-01-10 20:57:02 +00:00
|
|
|
end
|
|
|
|
end
|
2017-04-30 23:40:29 +00:00
|
|
|
love.keyreleased = function(key)
|
|
|
|
return pop.keyreleased(key)
|
|
|
|
end
|
|
|
|
love.textinput = function(text)
|
|
|
|
return pop.textinput(text)
|
|
|
|
end
|