Compare commits
No commits in common. "60fedd28d7b2674b2c7515fb3c51c4feddb5bddf" and "6dabb64d53402fcffd1bebc61bfb6fb094fe2559" have entirely different histories.
60fedd28d7
...
6dabb64d53
10 changed files with 33 additions and 156 deletions
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 158 B |
Binary file not shown.
Before Width: | Height: | Size: 145 B |
Binary file not shown.
Before Width: | Height: | Size: 139 B |
74
main.lua
74
main.lua
|
@ -4,41 +4,7 @@ for k, v in pairs(_G) do
|
||||||
end
|
end
|
||||||
|
|
||||||
love.graphics.setDefaultFilter('nearest', 'nearest')
|
love.graphics.setDefaultFilter('nearest', 'nearest')
|
||||||
|
interfaceFont = love.graphics.newFont('assets/fonts/Inter-Regular.otf', 20)
|
||||||
local fontSize = 20
|
|
||||||
interfaceFont = love.graphics.newFont('assets/fonts/Inter-Regular.otf', fontSize)
|
|
||||||
|
|
||||||
local fontCache = {}
|
|
||||||
|
|
||||||
function getFont(size, italic)
|
|
||||||
if fontCache[size] and fontCache[size][italic] then return fontCache[size][italic] end
|
|
||||||
|
|
||||||
fontCache[size] = fontCache[size] or {}
|
|
||||||
fontCache[size][italic] = love.graphics.newFont('assets/fonts/Inter-' .. (italic and 'Italic' or 'Regular') .. '.otf', math.floor(fontSize * size))
|
|
||||||
return fontCache[size][italic]
|
|
||||||
end
|
|
||||||
|
|
||||||
function getMousePosition()
|
|
||||||
local x, y = love.mouse.getPosition()
|
|
||||||
|
|
||||||
local sx, sy, sw, sh = 0, 0, love.graphics.getWidth(), love.graphics.getHeight()
|
|
||||||
if love.isVersionCompatible('11.3') then sx, sy, sw, sh = love.window.getSafeArea() end
|
|
||||||
sx, sy, sw, sh = 100, 100, love.graphics.getWidth() - 200, love.graphics.getHeight() - 200
|
|
||||||
|
|
||||||
x, y = ((x - sx) / sw) * love.graphics.getWidth(), ((y - sy) / sh) * love.graphics.getHeight()
|
|
||||||
|
|
||||||
return x, y
|
|
||||||
end
|
|
||||||
|
|
||||||
function getMouseX()
|
|
||||||
local x, y = getMousePosition()
|
|
||||||
return x
|
|
||||||
end
|
|
||||||
|
|
||||||
function getMouseY()
|
|
||||||
local x, y = getMousePosition()
|
|
||||||
return y
|
|
||||||
end
|
|
||||||
|
|
||||||
ease = require 'src.ease'
|
ease = require 'src.ease'
|
||||||
|
|
||||||
|
@ -76,8 +42,6 @@ screenshot = false
|
||||||
screenshotCanvas = nil
|
screenshotCanvas = nil
|
||||||
screenshotsize = 512
|
screenshotsize = 512
|
||||||
|
|
||||||
mobile = love.system.getOS() == 'iOS' or love.system.getOS() == 'Android'
|
|
||||||
|
|
||||||
-- global for convinience's sake
|
-- global for convinience's sake
|
||||||
|
|
||||||
mode = nil
|
mode = nil
|
||||||
|
@ -86,10 +50,6 @@ function love.load()
|
||||||
love.graphics.setFont(interfaceFont)
|
love.graphics.setFont(interfaceFont)
|
||||||
fontHeight = love.graphics.getFont():getHeight()
|
fontHeight = love.graphics.getFont():getHeight()
|
||||||
createUI()
|
createUI()
|
||||||
|
|
||||||
if mobile then
|
|
||||||
love.window.setMode(640, 360, {borderless = true, resizable = false, minwidth = 705, minheight = 510, fullscreen = true})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.update(dt)
|
function love.update(dt)
|
||||||
|
@ -101,9 +61,7 @@ function love.update(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.draw()
|
function love.draw()
|
||||||
local sx, sy, sw, sh = 0, 0, love.graphics.getWidth(), love.graphics.getHeight()
|
local sw, sh = love.graphics.getDimensions()
|
||||||
if love.isVersionCompatible('11.3') then sx, sy, sw, sh = love.window.getSafeArea() end
|
|
||||||
|
|
||||||
local mx, my = love.mouse.getPosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
|
|
||||||
if screenshot then
|
if screenshot then
|
||||||
|
@ -139,15 +97,9 @@ function love.draw()
|
||||||
love.graphics.setLineWidth(2)
|
love.graphics.setLineWidth(2)
|
||||||
|
|
||||||
love.graphics.setColor(0.09, 0.09, 0.12, 1)
|
love.graphics.setColor(0.09, 0.09, 0.12, 1)
|
||||||
love.graphics.rectangle('fill', 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
|
love.graphics.rectangle('fill', 0, 0, sw, sh)
|
||||||
love.graphics.setColor(0.08, 0.08, 0.1, 1)
|
love.graphics.setColor(0.08, 0.08, 0.1, 1)
|
||||||
love.graphics.rectangle('line', 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
|
love.graphics.rectangle('line', 0, 0, sw, sh)
|
||||||
|
|
||||||
love.graphics.push()
|
|
||||||
love.graphics.translate(sx, sy)
|
|
||||||
love.graphics.scale(sw/love.graphics.getWidth(), sh/love.graphics.getHeight())
|
|
||||||
|
|
||||||
sw, sh = love.graphics.getDimensions()
|
|
||||||
|
|
||||||
love.graphics.setColor(0.2, 0.2, 0.3, 1)
|
love.graphics.setColor(0.2, 0.2, 0.3, 1)
|
||||||
love.graphics.print('Box of Eases by oatmealine', outerpadding, sh - fontHeight - outerpadding)
|
love.graphics.print('Box of Eases by oatmealine', outerpadding, sh - fontHeight - outerpadding)
|
||||||
|
@ -163,26 +115,14 @@ function love.draw()
|
||||||
graph.render()
|
graph.render()
|
||||||
|
|
||||||
tooltips.render()
|
tooltips.render()
|
||||||
|
|
||||||
love.graphics.pop()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.mousepressed(x, y, m)
|
function love.mousepressed(x, y, m)
|
||||||
local sx, sy, sw, sh = 0, 0, love.graphics.getWidth(), love.graphics.getHeight()
|
|
||||||
if love.isVersionCompatible('11.3') then sx, sy, sw, sh = love.window.getSafeArea() end
|
|
||||||
|
|
||||||
x, y = ((x - sx) / sw) * love.graphics.getWidth(), ((y - sy) / sh) * love.graphics.getHeight()
|
|
||||||
|
|
||||||
if dropdown.mousepressed(x, y, m) then return end
|
if dropdown.mousepressed(x, y, m) then return end
|
||||||
button.mousepressed(x, y, m)
|
button.mousepressed(x, y, m)
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.mousereleased(x, y, m)
|
function love.mousereleased(x, y, m)
|
||||||
local sx, sy, sw, sh = 0, 0, love.graphics.getWidth(), love.graphics.getHeight()
|
|
||||||
if love.isVersionCompatible('11.3') then sx, sy, sw, sh = love.window.getSafeArea() end
|
|
||||||
|
|
||||||
x, y = ((x - sx) / sw) * love.graphics.getWidth(), ((y - sy) / sh) * love.graphics.getHeight()
|
|
||||||
|
|
||||||
if dropdown.mousereleased(x, y, m) then return end
|
if dropdown.mousereleased(x, y, m) then return end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -202,11 +142,5 @@ function love.keypressed(key)
|
||||||
print(k, v)
|
print(k, v)
|
||||||
::continue::
|
::continue::
|
||||||
end
|
end
|
||||||
elseif key == 'f2' then -- mobile mode
|
|
||||||
mobile = not mobile
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
function love.resize()
|
|
||||||
createUI()
|
|
||||||
end
|
end
|
|
@ -1,11 +1,5 @@
|
||||||
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)
|
||||||
|
@ -46,7 +40,6 @@ 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 = ''
|
||||||
|
|
||||||
|
@ -129,7 +122,6 @@ 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()
|
||||||
|
@ -137,27 +129,12 @@ 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
|
||||||
|
|
||||||
function self.update(dt)
|
function self.update(dt)
|
||||||
for i, v in ipairs(buttons) do
|
for i, v in ipairs(buttons) do
|
||||||
local mx, my = getMousePosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
|
|
||||||
local targetsize = 1
|
local targetsize = 1
|
||||||
if mx > v.x and mx < v.x + v.size and my > v.y and my < v.y + v.size and dropdown.openDropdown == 0 then
|
if mx > v.x and mx < v.x + v.size and my > v.y and my < v.y + v.size and dropdown.openDropdown == 0 then
|
||||||
|
@ -173,7 +150,7 @@ function self.update(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
function self.render()
|
function self.render()
|
||||||
local mx, my = getMousePosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
|
|
||||||
for i, v in ipairs(buttons) do
|
for i, v in ipairs(buttons) do
|
||||||
local x, y, w, h = v.x, v.y, v.size, v.size
|
local x, y, w, h = v.x, v.y, v.size, v.size
|
||||||
|
@ -188,17 +165,12 @@ function self.render()
|
||||||
|
|
||||||
love.graphics.setColor(0, 0, 0, 1)
|
love.graphics.setColor(0, 0, 0, 1)
|
||||||
if hovering or dragging then
|
if hovering or dragging then
|
||||||
love.graphics.setColor(0.4, 0.4, 1, 1)
|
love.graphics.setColor(0.2, 0.2, 0.3, 1)
|
||||||
if v.tooltip then tooltips.show(v.tooltip) end
|
if v.tooltip then tooltips.show(v.tooltip) end
|
||||||
end
|
end
|
||||||
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
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@ self.openDropdown = 0
|
||||||
local dropdownScroll = 0
|
local dropdownScroll = 0
|
||||||
local dropdownScrollE = 0
|
local dropdownScrollE = 0
|
||||||
|
|
||||||
local scrollbarSize = 6
|
|
||||||
|
|
||||||
local function skeys(t)
|
local function skeys(t)
|
||||||
local k = {}
|
local k = {}
|
||||||
for n,v in pairs(t) do table.insert(k, {n, v}) end
|
for n,v in pairs(t) do table.insert(k, {n, v}) end
|
||||||
|
@ -73,13 +71,6 @@ 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
|
||||||
|
@ -213,27 +204,15 @@ function self.update(dt)
|
||||||
v.open = mix(v.open, 0, dt * 20)
|
v.open = mix(v.open, 0, dt * 20)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if love.mouse.isDown(1) then
|
|
||||||
local x, y = getMousePosition()
|
|
||||||
for i,v in ipairs(dropdowns) do
|
|
||||||
local h = fontHeight + margin
|
|
||||||
if self.openDropdown == i then
|
|
||||||
if x > v.x and x > v.x + v.width - scrollbarSize and y > v.y + h and y < v.y + h * (math.min(#v.options, maxDropdown) + 1) and not (#v.options < maxDropdown) then
|
|
||||||
dropdownScroll = ((y - (v.y + h)) / (h * (math.min(#v.options, maxDropdown)))) * -(#v.options - maxDropdown + 1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function self.render()
|
function self.render()
|
||||||
local mx, my = getMousePosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
for i,v in ipairs(dropdowns) do
|
for i,v in ipairs(dropdowns) do
|
||||||
local x, y, w, h = v.x, v.y, v.width, fontHeight + margin
|
local x, y, w, h = v.x, v.y, v.width, fontHeight + margin
|
||||||
|
|
||||||
love.graphics.setColor(0.06, 0.06, 0.12, 0.6)
|
love.graphics.setColor(0.06, 0.06, 0.12, 0.6)
|
||||||
if mx > x and mx < x + w and my > y and my < y + h then
|
if love.mouse.getX() > x and love.mouse.getX() < x + w and love.mouse.getY() > y and love.mouse.getY() < y + h then
|
||||||
love.graphics.setColor(0.8, 0.8, 1, love.mouse.isDown(1) and 0.4 or 0.3)
|
love.graphics.setColor(0.8, 0.8, 1, love.mouse.isDown(1) and 0.4 or 0.3)
|
||||||
if v.tooltip then tooltips.show(v.tooltip) end
|
if v.tooltip then tooltips.show(v.tooltip) end
|
||||||
end
|
end
|
||||||
|
@ -295,10 +274,13 @@ function self.render()
|
||||||
str = str .. ' ' .. string.sub(p.name, 1, 1)
|
str = str .. ' ' .. string.sub(p.name, 1, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
love.graphics.setFont(getFont(0.8, true))
|
love.graphics.push()
|
||||||
|
love.graphics.translate(x + w, y + lineWidth/2)
|
||||||
|
love.graphics.shear(-0.2, 0)
|
||||||
|
love.graphics.scale(0.8, 0.8)
|
||||||
love.graphics.setColor(0.8, 0.8, 1, 0.8 * a)
|
love.graphics.setColor(0.8, 0.8, 1, 0.8 * a)
|
||||||
love.graphics.printf(str, x, y, w - 2, 'right')
|
love.graphics.printf(str, -w, -lineWidth/2, w - 2, 'right')
|
||||||
love.graphics.setFont(interfaceFont)
|
love.graphics.pop()
|
||||||
end
|
end
|
||||||
|
|
||||||
::continue::
|
::continue::
|
||||||
|
@ -309,7 +291,7 @@ function self.render()
|
||||||
if #v.options > maxDropdown then
|
if #v.options > maxDropdown then
|
||||||
local displayed = maxDropdown / (#v.options)
|
local displayed = maxDropdown / (#v.options)
|
||||||
local scroll = math.abs(dropdownScrollE) / (#v.options - maxDropdown + 1)
|
local scroll = math.abs(dropdownScrollE) / (#v.options - maxDropdown + 1)
|
||||||
local size = scrollbarSize
|
local size = 3
|
||||||
|
|
||||||
love.graphics.setColor(1, 1, 1, 0.8 * v.open)
|
love.graphics.setColor(1, 1, 1, 0.8 * v.open)
|
||||||
love.graphics.rectangle('fill', x + w - size, y + h + scroll * (1 - displayed) * (maxDropdown - 1) * h * v.open, size, displayed * (maxDropdown - 1) * h * v.open)
|
love.graphics.rectangle('fill', x + w - size, y + h + scroll * (1 - displayed) * (maxDropdown - 1) * h * v.open, size, displayed * (maxDropdown - 1) * h * v.open)
|
||||||
|
@ -352,7 +334,7 @@ function self.mousereleased(x, y, m)
|
||||||
for i,v in ipairs(dropdowns) do
|
for i,v in ipairs(dropdowns) do
|
||||||
local h = fontHeight + margin
|
local h = fontHeight + margin
|
||||||
if self.openDropdown == i then
|
if self.openDropdown == i then
|
||||||
if x > v.x and x < v.x + v.width and y > v.y + h and y < v.y + h * (math.min(#v.options, maxDropdown) + 1) and m == 1 and (x < v.x + v.width - scrollbarSize or #v.options < maxDropdown) then
|
if x > v.x and x < v.x + v.width and y > v.y + h and y < v.y + h * (math.min(#v.options, maxDropdown) + 1) and m == 1 then
|
||||||
v.selected = math.floor((y - v.y) / h - dropdownScrollE)
|
v.selected = math.floor((y - v.y) / h - dropdownScrollE)
|
||||||
self.openDropdown = 0
|
self.openDropdown = 0
|
||||||
dropdownValueCache[v.name] = {selected = v.selected}
|
dropdownValueCache[v.name] = {selected = v.selected}
|
||||||
|
@ -367,7 +349,7 @@ function self.wheelmoved(x, y)
|
||||||
if self.openDropdown ~= 0 then
|
if self.openDropdown ~= 0 then
|
||||||
dropdownScroll = dropdownScroll + y
|
dropdownScroll = dropdownScroll + y
|
||||||
else
|
else
|
||||||
local mx, my = getMousePosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
for i,v in ipairs(dropdowns) do
|
for i,v in ipairs(dropdowns) do
|
||||||
local h = fontHeight + margin
|
local h = fontHeight + margin
|
||||||
if mx > v.x and mx < v.x + v.width and my > v.y and my < v.y + h + margin then
|
if mx > v.x and mx < v.x + v.width and my > v.y and my < v.y + h + margin then
|
||||||
|
|
|
@ -37,7 +37,7 @@ function self.update(dt)
|
||||||
local csize = 10 -- preview point size
|
local csize = 10 -- preview point size
|
||||||
local size = math.min((sw - outerpadding) - ((dropdown.kget('ease2') or dropdown.kget('ease1')).x + dropdownWidth + padding), sh - outerpadding * 2 - padding * 3 - csize)
|
local size = math.min((sw - outerpadding) - ((dropdown.kget('ease2') or dropdown.kget('ease1')).x + dropdownWidth + padding), sh - outerpadding * 2 - padding * 3 - csize)
|
||||||
local x, y, w, h = sw - outerpadding - size, outerpadding, size, size
|
local x, y, w, h = sw - outerpadding - size, outerpadding, size, size
|
||||||
local mx, my = getMousePosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
|
|
||||||
if not (love.mouse.isDown(1) and mx > x and mx < x + w and my > y and my < y + h) then
|
if not (love.mouse.isDown(1) and mx > x and mx < x + w and my > y and my < y + h) then
|
||||||
timer = (timer + dt * ((slider.kvalue('bpm') or 120)/120)) % 2
|
timer = (timer + dt * ((slider.kvalue('bpm') or 120)/120)) % 2
|
||||||
|
@ -68,7 +68,7 @@ function self.render()
|
||||||
love.graphics.rectangle('line', x, y, w, h)
|
love.graphics.rectangle('line', x, y, w, h)
|
||||||
|
|
||||||
-- grid
|
-- grid
|
||||||
love.graphics.setColor(0.2, 0.2, 0.3, 0.2)
|
love.graphics.setColor(0.2, 0.2, 0.4, 0.2)
|
||||||
local gridsize = 64
|
local gridsize = 64
|
||||||
for gx = 1, gridsize - 2 do
|
for gx = 1, gridsize - 2 do
|
||||||
love.graphics.line(x + margin + gx * w/gridsize, y + margin, x + margin + gx * w/gridsize, y + h - margin)
|
love.graphics.line(x + margin + gx * w/gridsize, y + margin, x + margin + gx * w/gridsize, y + h - margin)
|
||||||
|
@ -99,7 +99,7 @@ function self.render()
|
||||||
-- polygone
|
-- polygone
|
||||||
-- this isnt done with a polygon because else itd waste a Bunch of ram and i kinda, dont want to do that?
|
-- this isnt done with a polygon because else itd waste a Bunch of ram and i kinda, dont want to do that?
|
||||||
love.graphics.setColor(1, 1, 1, 1)
|
love.graphics.setColor(1, 1, 1, 1)
|
||||||
love.graphics.setScissor(x + margin, y + margin, math.abs(w - (margin * 2)), math.abs(h - (margin * 2)))
|
love.graphics.setScissor(x + margin, y + margin, w - (margin * 2), h - (margin * 2))
|
||||||
local last = (((graph[1] or 0) - 0.5) * zoome) + 0.5
|
local last = (((graph[1] or 0) - 0.5) * zoome) + 0.5
|
||||||
for gx = 1, quality - 1 do
|
for gx = 1, quality - 1 do
|
||||||
local a = gx/quality
|
local a = gx/quality
|
||||||
|
@ -129,7 +129,7 @@ function self.render()
|
||||||
|
|
||||||
-- preview
|
-- preview
|
||||||
if not screenshot then
|
if not screenshot then
|
||||||
love.graphics.setScissor(x - margin, 0, math.abs(w + margin * 2), sh)
|
love.graphics.setScissor(x - margin, 0, w + margin * 2, sh)
|
||||||
love.graphics.setColor(0.16, 0.16, 0.17, 1)
|
love.graphics.setColor(0.16, 0.16, 0.17, 1)
|
||||||
love.graphics.line(x + margin, y + h + padding * 2 + csize/2, x + w - margin, y + h + padding * 2 + csize/2)
|
love.graphics.line(x + margin, y + h + padding * 2 + csize/2, x + w - margin, y + h + padding * 2 + csize/2)
|
||||||
love.graphics.setColor(0.3, 0.3, 0.31, 1)
|
love.graphics.setColor(0.3, 0.3, 0.31, 1)
|
||||||
|
@ -153,7 +153,7 @@ function self.render()
|
||||||
end
|
end
|
||||||
|
|
||||||
function self.wheelmoved(wx, wy)
|
function self.wheelmoved(wx, wy)
|
||||||
local mx, my = getMousePosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
|
|
||||||
-- may need to abstract this out, somehow
|
-- may need to abstract this out, somehow
|
||||||
-- todo
|
-- todo
|
||||||
|
|
|
@ -77,14 +77,13 @@ function self.createSliders()
|
||||||
for i,v in ipairs(param1) do
|
for i,v in ipairs(param1) do
|
||||||
insertSlider(s, {
|
insertSlider(s, {
|
||||||
x = outerpadding + dropdownWidth + padding,
|
x = outerpadding + dropdownWidth + padding,
|
||||||
y = outerpadding + (fontHeight * 3 + padding) * i - padding,
|
y = outerpadding + (fontHeight * 2.5 + padding) * i,
|
||||||
width = dropdownWidth,
|
width = dropdownWidth,
|
||||||
min = v.min,
|
min = v.min,
|
||||||
max = v.max,
|
max = v.max,
|
||||||
default = v.default,
|
default = v.default,
|
||||||
name = ease1.name .. 'param1' .. i,
|
name = ease1.name .. 'param1' .. i,
|
||||||
topdisplayname = 'Parameter',
|
displayname = 'Parameter ' .. v.name
|
||||||
displayname = v.name
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -92,14 +91,13 @@ function self.createSliders()
|
||||||
for i,v in ipairs(param2) do
|
for i,v in ipairs(param2) do
|
||||||
insertSlider(s, {
|
insertSlider(s, {
|
||||||
x = outerpadding + dropdownWidth + padding + dropdownWidth + padding,
|
x = outerpadding + dropdownWidth + padding + dropdownWidth + padding,
|
||||||
y = outerpadding + (fontHeight * 3 + padding) * i - padding,
|
y = outerpadding + (fontHeight * 2.5 + padding) * i,
|
||||||
width = dropdownWidth,
|
width = dropdownWidth,
|
||||||
min = v.min,
|
min = v.min,
|
||||||
max = v.max,
|
max = v.max,
|
||||||
default = v.default,
|
default = v.default,
|
||||||
name = ease2.name .. 'param2' .. i,
|
name = ease2.name .. 'param2' .. i,
|
||||||
topdisplayname = 'Parameter',
|
displayname = 'Parameter ' .. v.name
|
||||||
displayname = v.name
|
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -126,7 +124,7 @@ function self.update(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
function self.render()
|
function self.render()
|
||||||
local mx, my = getMousePosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
|
|
||||||
for i, v in ipairs(sliders) do
|
for i, v in ipairs(sliders) do
|
||||||
local x, y, w, h = v.x, v.y, v.width, fontHeight * 1.25
|
local x, y, w, h = v.x, v.y, v.width, fontHeight * 1.25
|
||||||
|
@ -170,13 +168,6 @@ function self.render()
|
||||||
|
|
||||||
love.graphics.printf(v.displayname, v.x + margin * 2 - ssize * 6, v.y - ssize, ssize * 12, 'center')
|
love.graphics.printf(v.displayname, v.x + margin * 2 - ssize * 6, v.y - ssize, ssize * 12, 'center')
|
||||||
|
|
||||||
if v.topdisplayname then
|
|
||||||
love.graphics.setColor(0.4, 0.4, 0.55, 1)
|
|
||||||
love.graphics.setFont(getFont(0.75, true))
|
|
||||||
love.graphics.printf(v.topdisplayname, v.x - ssize * 6, v.y - ssize * 1.45, ssize * 12, 'center')
|
|
||||||
love.graphics.setFont(interfaceFont)
|
|
||||||
end
|
|
||||||
|
|
||||||
if dragging then
|
if dragging then
|
||||||
v.value = ((mx - (x + 1)) / (w - 2)) * (v.max - v.min) + v.min
|
v.value = ((mx - (x + 1)) / (w - 2)) * (v.max - v.min) + v.min
|
||||||
if v.name == 'mix' then graph.touchtimer = 1 end -- sorry !!!
|
if v.name == 'mix' then graph.touchtimer = 1 end -- sorry !!!
|
||||||
|
|
|
@ -11,7 +11,7 @@ local tooltiptargetwidth = 0
|
||||||
local tooltipframe = false
|
local tooltipframe = false
|
||||||
|
|
||||||
function self.update(dt)
|
function self.update(dt)
|
||||||
local mx, my = getMousePosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
tooltipx = mix(tooltipx, mx, dt * 18)
|
tooltipx = mix(tooltipx, mx, dt * 18)
|
||||||
tooltipy = mix(tooltipy, my, dt * 18)
|
tooltipy = mix(tooltipy, my, dt * 18)
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ local function softlimit(x, f)
|
||||||
end
|
end
|
||||||
|
|
||||||
function self.render()
|
function self.render()
|
||||||
local mx, my = getMousePosition()
|
local mx, my = love.mouse.getPosition()
|
||||||
if not tooltipframe then
|
if not tooltipframe then
|
||||||
tooltiptargetwidth = 0
|
tooltiptargetwidth = 0
|
||||||
end
|
end
|
||||||
|
@ -44,10 +44,10 @@ function self.render()
|
||||||
if tooltipwidth > 1 then
|
if tooltipwidth > 1 then
|
||||||
local a = math.min((tooltipwidth - 1) / 6, 1)
|
local a = math.min((tooltipwidth - 1) / 6, 1)
|
||||||
|
|
||||||
local x, y, w, h = mx + 8, my + 8, (tooltipwidth + 4 + margin) * 0.8, (fontHeight + margin) * 0.8
|
local x, y, w, h = mx + 8, my + 8, (tooltipwidth + 4 + margin), (fontHeight + margin)
|
||||||
|
|
||||||
local easiness = 3 -- hehe. magic numbers
|
local easiness = 3 -- hehe. magic numbers
|
||||||
local scale = 1
|
local scale = 0.8
|
||||||
local sx, sy = ((w - softlimit(mx - tooltipx, w/easiness)/easiness) / w) * scale, ((h - softlimit(my - tooltipy, h/easiness)/easiness) / h) * scale
|
local sx, sy = ((w - softlimit(mx - tooltipx, w/easiness)/easiness) / w) * scale, ((h - softlimit(my - tooltipy, h/easiness)/easiness) / h) * scale
|
||||||
|
|
||||||
love.graphics.push()
|
love.graphics.push()
|
||||||
|
@ -61,9 +61,7 @@ function self.render()
|
||||||
love.graphics.setScissor(0, 0, math.max(mx + (tooltipwidth + 2 + margin/2 + 16) * sx, 0), love.graphics.getHeight())
|
love.graphics.setScissor(0, 0, math.max(mx + (tooltipwidth + 2 + margin/2 + 16) * sx, 0), love.graphics.getHeight())
|
||||||
|
|
||||||
love.graphics.setColor(1, 1, 1, a)
|
love.graphics.setColor(1, 1, 1, a)
|
||||||
love.graphics.setFont(getFont(0.8, false))
|
love.graphics.print(tooltiptext, 2 + margin/2, 2 + margin/2)
|
||||||
love.graphics.print(tooltiptext, 2, 2)
|
|
||||||
love.graphics.setFont(interfaceFont)
|
|
||||||
|
|
||||||
love.graphics.setScissor()
|
love.graphics.setScissor()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue