make copy to clipboard button
This commit is contained in:
parent
0266e2c2e9
commit
15316b918f
1 changed files with 69 additions and 11 deletions
80
button.lua
80
button.lua
|
@ -24,17 +24,75 @@ function self.createButtons()
|
|||
local s = {}
|
||||
buttonId = 0
|
||||
|
||||
insertButton(s, {
|
||||
x = outerpadding,
|
||||
y = love.graphics.getHeight() - outerpadding - fontHeight * 4 - padding * 2 - 32,
|
||||
size = 32,
|
||||
name = 'clipboard',
|
||||
displayname = 'Copy to Clipboard',
|
||||
tooltip = 'Copy to Clipboard',
|
||||
func = function()
|
||||
love.system.setClipboardText('ease function goes here')
|
||||
end
|
||||
})
|
||||
if mode == modes.mix or mode == modes.preview or mode == modes.multiply then
|
||||
insertButton(s, {
|
||||
x = outerpadding,
|
||||
y = love.graphics.getHeight() - outerpadding - fontHeight * 4 - padding * 2 - 32,
|
||||
size = 32,
|
||||
name = 'clipboard',
|
||||
displayname = 'Copy to Clipboard',
|
||||
tooltip = 'Copy to Clipboard',
|
||||
func = function()
|
||||
local s = ''
|
||||
|
||||
local param1 = {}
|
||||
local param2 = {}
|
||||
|
||||
if mode == modes.preview then
|
||||
local e = ease.eases[dropdown.kselected('ease1')]
|
||||
|
||||
param1[1] = slider.kvalue(e.name .. 'param11') or (e.params[1] and e.params[1].default) or 1
|
||||
param1[2] = slider.kvalue(e.name .. 'param12') or (e.params[2] and e.params[2].default) or 1
|
||||
|
||||
local p1 = ''
|
||||
for i,v in ipairs(param1) do
|
||||
p1 = p1 .. (i > 1 and (', ' .. v) or v)
|
||||
end
|
||||
|
||||
s = e.name .. (p1 ~= '' and ('.params(' .. p1 .. ')') or '')
|
||||
elseif mode == modes.mix then
|
||||
local e1 = ease.eases[dropdown.kselected('ease1')]
|
||||
local e2 = ease.eases[dropdown.kselected('ease2')]
|
||||
|
||||
param1[1] = slider.kvalue(e1.name .. 'param11') or (e1.params[1] and e1.params[1].default) or 1
|
||||
param1[2] = slider.kvalue(e1.name .. 'param12') or (e1.params[2] and e1.params[2].default) or 1
|
||||
param2[1] = slider.kvalue(e2.name .. 'param21') or (e2.params[1] and e2.params[1].default) or 1
|
||||
param2[2] = slider.kvalue(e2.name .. 'param22') or (e2.params[2] and e2.params[2].default) or 1
|
||||
|
||||
local p1 = ''
|
||||
for i,v in ipairs(param1) do
|
||||
p1 = p1 .. (i > 1 and (', ' .. v) or v)
|
||||
end
|
||||
local p2 = ''
|
||||
for i,v in ipairs(param2) do
|
||||
p2 = p2 .. (i > 1 and (', ' .. v) or v)
|
||||
end
|
||||
|
||||
s = 'mixEase(' .. e1.name .. (p1 ~= '' and ('.params(' .. p1 .. ')') or '') .. ', ' .. e2.name .. (p2 ~= '' and ('.params(' .. p2 .. ')') or '') .. ', ' .. slider.kvalue('mix') .. ')'
|
||||
elseif mode == modes.multiply then
|
||||
local e1 = ease.eases[dropdown.kselected('ease1')]
|
||||
local e2 = ease.eases[dropdown.kselected('ease2')]
|
||||
|
||||
param1[1] = slider.kvalue(_e1.name .. 'param11') or (_e1.params[1] and _e1.params[1].default) or 1
|
||||
param1[2] = slider.kvalue(_e1.name .. 'param12') or (_e1.params[2] and _e1.params[2].default) or 1
|
||||
param2[1] = slider.kvalue(_e2.name .. 'param21') or (_e2.params[1] and _e2.params[1].default) or 1
|
||||
param2[2] = slider.kvalue(_e2.name .. 'param22') or (_e2.params[2] and _e2.params[2].default) or 1
|
||||
|
||||
local p1 = ''
|
||||
for i,v in ipairs(param1) do
|
||||
p1 = p1 .. (i > 1 and (', ' .. v) or v)
|
||||
end
|
||||
local p2 = ''
|
||||
for i,v in ipairs(param2) do
|
||||
p2 = p2 .. (i > 1 and (', ' .. v) or v)
|
||||
end
|
||||
|
||||
s = 'function(x) ' .. e2.name .. (p2 ~= '' and ('.params(' .. p2 .. ')') or '') .. '(' .. e1.name .. (p1 ~= '' and ('.params(' .. p1 .. ')') or '') .. '(x)) end'
|
||||
end
|
||||
love.system.setClipboardText(s)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
buttons = s
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue