-
Notifications
You must be signed in to change notification settings - Fork 26
Getting Started
Gustavo Lara edited this page Apr 24, 2017
·
19 revisions
Let's create a button with an event. X and Y coordinates are 10 and 10 by default, width and height fit the text:
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
[Finished in 13.7s]
Result:
require "gooi"
function love.load()
gooi.newButton({
text = "Exit",
x = 100,
y = 100,
w = 150,
h = 35,
align = "left",
icon = "imgs/exit.png"
}):onRelease(function()
gooi.confirm("Are you sure?", function()
love.event.quit()
end)
end)
:warning()
end
function love.draw()
gooi.draw()
end
function love.mousepressed(x, y, button) gooi.pressed() end
function love.mousereleased(x, y, button) gooi.released() end
Result:
(Note how update operations are needed here)
require "gooi"
function love.load()
btn = gooi.newButton({
text = "Exit",
x = 100,
y = 100,
w = 150,
h = 35,
align = "left",
icon = "imgs/exit.png"
}):onRelease(function()
gooi.confirm("Are you sure?", function()
love.event.quit()
end)
end)
:warning()
slider = gooi.newSlider()
end
function love.update(dt)
gooi.update(dt)
btn.style.bgColor[2] = slider:getValue() * 255
end
function love.draw()
gooi.draw()
end
function love.mousepressed(x, y, button) gooi.pressed() end
function love.mousereleased(x, y, button) gooi.released() end