actually implement buttons

This commit is contained in:
jill 2021-09-19 14:37:46 +03:00
parent 7aeb9afb89
commit 0266e2c2e9
4 changed files with 14 additions and 2 deletions

View file

@ -30,7 +30,10 @@ function self.createButtons()
size = 32, size = 32,
name = 'clipboard', name = 'clipboard',
displayname = 'Copy to Clipboard', displayname = 'Copy to Clipboard',
tooltip = 'Copy to Clipboard' tooltip = 'Copy to Clipboard',
func = function()
love.system.setClipboardText('ease function goes here')
end
}) })
buttons = s buttons = s
@ -78,4 +81,12 @@ function self.render()
end end
end end
function self.mousepressed(x, y, m)
for i, v in ipairs(buttons) do
if x > v.x and x < v.x + v.size and y > v.y and y < v.y + v.size and m == 1 then
if v.func then v.func() end
end
end
end
return self return self

View file

@ -327,7 +327,6 @@ function self.mousepressed(x, y, m)
if not clickedDropdown and m == 1 then if not clickedDropdown and m == 1 then
dropdownScrollCache[self.openDropdown] = dropdownScroll dropdownScrollCache[self.openDropdown] = dropdownScroll
self.openDropdown = 0 self.openDropdown = 0
return true
end end
end end

View file

@ -88,6 +88,7 @@ end
function love.mousepressed(x, y, m) function love.mousepressed(x, y, m)
if dropdown.mousepressed(x, y, m) then return end if dropdown.mousepressed(x, y, m) then return end
button.mousepressed(x, y, m)
end end
function love.mousereleased(x, y, m) function love.mousereleased(x, y, m)

View file

@ -62,6 +62,7 @@ function self.createSliders()
name = 'bpm', name = 'bpm',
displayname = 'BPM', displayname = 'BPM',
snap = 1, snap = 1,
tooltip = 'The speed of the preview dot in Beats Per Minute'
}) })
end end