UPDATE:
Windows are now a thing!
I wanted to keep Uare as customisable and easy as possible, so I haven't included any uare.newWindow or uare.newButton methods.
Instead, you simply create elements using
uare.new(). To make a window, you just make a draggable element and
anchor a close button and a content element to it. That's what a window consists of, right?
This said, I implemented
anchors and
groups. Here's how you'd make a simple window with Uare:
Code: Select all
function createWindow(x, y)
local group = uare.newGroup()
local top = uare.new({ --draggable part of our window, to which everything is anchored
x = x,
y = y,
width = 250,
height = 30,
drag = true,
color = {160, 160, 160},
text = {
display = "my window",
font = love.graphics.newFont(28),
color = {255, 255, 255},
offset = {
x = 16,
y = -16
}
}
}):group(group)
local close = uare.new({
x = x+200,
y = y,
width = 50,
height = 30,
color = {200, 100, 100},
onCleanRelease = function() group:setActive(false) group:setVisible(false, .5) end, --close our window
}):anchor(top):group(group)
local content = uare.new({
x = x,
y = y+30,
width = 250,
height = 300,
color = {255, 255, 255},
}):anchor(top):group(group)
return {top = top, close = close, content = content, group = group}
end
And then you access your window elements using window.top, window.close, window.content.
It's that simple.