add a swap button for eases

This commit is contained in:
jill 2021-09-19 22:11:33 +03:00
parent 6dabb64d53
commit a861a2dd11
5 changed files with 35 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

BIN
assets/textures/swap.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

View file

@ -1,5 +1,11 @@
local self = {} local self = {}
local icon = {
clipboard = love.graphics.newImage('assets/textures/clipboard.png'),
screenshot = love.graphics.newImage('assets/textures/screenshot.png'),
swap = love.graphics.newImage('assets/textures/swap.png'),
}
local buttons = {} local buttons = {}
function self.get(index) function self.get(index)
@ -40,6 +46,7 @@ function self.createButtons()
name = 'clipboard', name = 'clipboard',
displayname = 'Copy to Clipboard', displayname = 'Copy to Clipboard',
tooltip = 'Copy to Clipboard', tooltip = 'Copy to Clipboard',
icon = 'clipboard',
func = function() func = function()
local s = '' local s = ''
@ -122,6 +129,7 @@ function self.createButtons()
name = 'screenshot', name = 'screenshot',
displayname = 'Screenshot', displayname = 'Screenshot',
tooltip = 'Take a screenshot', tooltip = 'Take a screenshot',
icon = 'screenshot',
func = function() func = function()
screenshot = true screenshot = true
screenshotCanvas = love.graphics.newCanvas() screenshotCanvas = love.graphics.newCanvas()
@ -129,6 +137,21 @@ function self.createButtons()
}) })
end end
if mode == modes.mix or mode == modes.multiply then
insertButton(s, {
x = outerpadding + dropdownWidth * 2 + padding,
y = outerpadding + fontHeight/2 - padding/2,
size = padding,
name = 'swap',
displayname = 'Swap',
icon = 'swap',
func = function()
dropdown.swap('ease1', 'ease2')
createUI()
end
})
end
buttons = s buttons = s
end end
@ -171,6 +194,11 @@ function self.render()
love.graphics.rectangle('fill', x, y, w, h) love.graphics.rectangle('fill', x, y, w, h)
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.rectangle('line', x, y, w, h) love.graphics.rectangle('line', x, y, w, h)
if v.icon and icon[v.icon] then
local icon = icon[v.icon]
love.graphics.draw(icon, x, y, 0, w / icon:getWidth(), h / icon:getHeight())
end
end end
end end

View file

@ -71,6 +71,13 @@ function self.kselected(key)
end end
end end
function self.swap(key, key2)
local a, b = self.kget(key), self.kget(key2)
local s = a.selected
a.selected = b.selected
b.selected = s
end
local dropdownId local dropdownId
local function insertDropdown(tab, f) local function insertDropdown(tab, f)
dropdownId = dropdownId + 1 dropdownId = dropdownId + 1