diff --git a/main.lua b/main.lua index ae4b5ea..906d9f9 100644 --- a/main.lua +++ b/main.lua @@ -38,10 +38,6 @@ dropdownWidth = 186 lineWidth = 2 fontHeight = love.graphics.getFont():getHeight() -screenshot = false -screenshotCanvas = nil -screenshotsize = 512 - -- global for convinience's sake mode = nil @@ -64,33 +60,6 @@ function love.draw() local sw, sh = love.graphics.getDimensions() local mx, my = love.mouse.getPosition() - if screenshot then - love.graphics.setCanvas(screenshotCanvas) - sw, sh = screenshotsize, screenshotsize - love.graphics.setColor(0.09, 0.09, 0.12, 1) - love.graphics.rectangle('fill', 0, 0, sw, sh) - love.graphics.setColor(0.08, 0.08, 0.1, 1) - love.graphics.rectangle('line', 0, 0, sw, sh) - graph.render() - love.graphics.setCanvas() - - --[[ - -- for seeing what gets drawn to it - love.graphics.setColor(1, 1, 1) - love.graphics.draw(screenshotCanvas) - - return - ]] - - local ss = screenshotCanvas:newImageData(0, 1, 0, 0, screenshotsize, screenshotsize) - ss:encode('png', 'screenshot ' .. os.date('%Y-%m-%d %H-%m') .. '.png') - love.system.openURL('file://' .. love.filesystem.getSaveDirectory()) - - screenshot = false - end - - love.graphics.setCanvas() - -- this is fine to do since all textures are already loaded with nearest love.graphics.setDefaultFilter('linear', 'linear') diff --git a/src/button.lua b/src/button.lua index 4b13ece..53e93c9 100644 --- a/src/button.lua +++ b/src/button.lua @@ -115,18 +115,6 @@ function self.createButtons() love.system.setClipboardText(s) end }) - insertButton(s, { - x = outerpadding + padding + 32, - y = love.graphics.getHeight() - outerpadding - fontHeight * 4 - padding * 2 - 32, - size = 32, - name = 'screenshot', - displayname = 'Screenshot', - tooltip = 'Take a screenshot', - func = function() - screenshot = true - screenshotCanvas = love.graphics.newCanvas() - end - }) end buttons = s diff --git a/src/graph.lua b/src/graph.lua index 1f46cea..22d344f 100644 --- a/src/graph.lua +++ b/src/graph.lua @@ -55,15 +55,7 @@ function self.render() 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) - if screenshot then - size = screenshotsize - outerpadding * 2 - end - local x, y, w, h = sw - outerpadding - size, outerpadding, size, size - if screenshot then - x, y = outerpadding, outerpadding - end - love.graphics.setColor(1, 1, 1, 1) love.graphics.rectangle('line', x, y, w, h) @@ -85,10 +77,8 @@ function self.render() -- preview point local t = timer % 1 - if not screenshot then - love.graphics.setColor(0.4, 0.4, 1, 0.4) - love.graphics.line(x + t * w, y, x + margin + t * (w - margin * 2), y + h) - end + love.graphics.setColor(0.4, 0.4, 1, 0.4) + love.graphics.line(x + t * w, y, x + margin + t * (w - margin * 2), y + h) -- y = 0 point -- todo: this will break with eases that dont have the first point at y0 @@ -99,20 +89,18 @@ function self.render() -- polygone -- 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.setScissor(x + margin, y + margin, w - (margin * 2), h - (margin * 2)) local last = (((graph[1] or 0) - 0.5) * zoome) + 0.5 for gx = 1, quality - 1 do local a = gx/quality local b = graph[gx + 1] or 0 b = ((b - 0.5) * zoome) + 0.5 - local px, py = x + margin + gx * ((w - margin * 2)/quality), y + h - margin - b * (h - margin * 2) - local ox, oy = x + margin + (gx - 1) * ((w - margin * 2)/quality), y + h - margin - last * (h - margin * 2) + local px, py = x + margin + gx * ((w - margin)/quality), y + h - margin - b * (h - margin * 2) + local ox, oy = x + margin + (gx - 1) * ((w - margin)/quality), y + h - margin - last * (h - margin * 2) if math.abs(b - last) < 1 then love.graphics.line(ox, oy, px, py) end last = b end - love.graphics.setScissor() -- zoom lines local a = math.min(math.abs(zoome - 1) * 10, 1) @@ -128,27 +116,23 @@ function self.render() end -- preview - if not screenshot then - love.graphics.setScissor(x - margin, 0, w + margin * 2, sh) - 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.setColor(0.3, 0.3, 0.31, 1) - love.graphics.line(x + margin + (w - margin * 2) * (1 - zoome) * 0.5, y + h + padding * 2 + csize/2, x + w - margin - (w - margin * 2) * (1 - zoome) * 0.5, y + h + padding * 2 + csize/2) + 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.setColor(0.3, 0.3, 0.31, 1) + love.graphics.line(x + margin + (w - margin * 2) * (1 - zoome) * 0.5, y + h + padding * 2 + csize/2, x + w - margin - (w - margin * 2) * (1 - zoome) * 0.5, y + h + padding * 2 + csize/2) - love.graphics.setColor(0.4, 0.4, 1, 1) - local a1 = ease.ease(t) - local a2 = ease.ease(math.max(math.min(t - 0.1, 1), 0)) - local da = ((a1 - 0.5) * zoome) + 0.5 - if timer % 2 > 1 and math.floor(ease.ease(0) + 0.5) ~= math.floor(ease.ease(1) + 0.5) then - da = 1 - da - end - if minEase then - da = da / 2 + 0.5 - end - - love.graphics.ellipse('fill', x + margin + (w - margin * 2) * da, y + h + padding * 2 + csize/2, csize * (1 + math.min(math.abs(a1 - a2), 3) * 1.2), csize) - love.graphics.setScissor() + love.graphics.setColor(0.4, 0.4, 1, 1) + local a1 = ease.ease(t) + local a2 = ease.ease(math.max(math.min(t - 0.1, 1), 0)) + local da = ((a1 - 0.5) * zoome) + 0.5 + if timer % 2 > 1 and math.floor(ease.ease(0) + 0.5) ~= math.floor(ease.ease(1) + 0.5) then + da = 1 - da end + if minEase then + da = da / 2 + 0.5 + end + + love.graphics.ellipse('fill', x + margin + (w - margin * 2) * da, y + h + padding * 2 + csize/2, csize * (1 + math.min(math.abs(a1 - a2), 3) * 1.2), csize) end end