From 0266e2c2e9b267cb5f1c84a1182fcb5532147c7a Mon Sep 17 00:00:00 2001 From: jill Date: Sun, 19 Sep 2021 14:37:46 +0300 Subject: [PATCH] actually implement buttons --- button.lua | 13 ++++++++++++- dropdown.lua | 1 - main.lua | 1 + slider.lua | 1 + 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/button.lua b/button.lua index b721dc0..5e40c95 100644 --- a/button.lua +++ b/button.lua @@ -30,7 +30,10 @@ function self.createButtons() size = 32, name = '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 @@ -78,4 +81,12 @@ function self.render() 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 \ No newline at end of file diff --git a/dropdown.lua b/dropdown.lua index 9d76d6a..5be76ca 100644 --- a/dropdown.lua +++ b/dropdown.lua @@ -327,7 +327,6 @@ function self.mousepressed(x, y, m) if not clickedDropdown and m == 1 then dropdownScrollCache[self.openDropdown] = dropdownScroll self.openDropdown = 0 - return true end end diff --git a/main.lua b/main.lua index 0a77eda..c540901 100644 --- a/main.lua +++ b/main.lua @@ -88,6 +88,7 @@ end function love.mousepressed(x, y, m) if dropdown.mousepressed(x, y, m) then return end + button.mousepressed(x, y, m) end function love.mousereleased(x, y, m) diff --git a/slider.lua b/slider.lua index 21bb29c..f1fcfd9 100644 --- a/slider.lua +++ b/slider.lua @@ -62,6 +62,7 @@ function self.createSliders() name = 'bpm', displayname = 'BPM', snap = 1, + tooltip = 'The speed of the preview dot in Beats Per Minute' }) end