unhardcore some rendering constants

This commit is contained in:
jill 2021-09-18 01:51:42 +03:00
parent f73073a9c6
commit 05bfac2221
3 changed files with 23 additions and 23 deletions

View file

@ -54,9 +54,9 @@ function self.createDropdowns()
local d = {}
dropdownId = 0
insertDropdown(d, {
x = padding,
y = padding,
width = 128,
x = outerpadding,
y = outerpadding,
width = dropdownWidth,
options = {
'Preview Ease',
'Mix Eases',
@ -67,34 +67,34 @@ function self.createDropdowns()
if d[dropdownId].selected == 1 then -- preview ease
insertDropdown(d, {
x = padding + 128 + padding,
y = padding,
width = 128,
x = outerpadding + dropdownWidth + padding,
y = outerpadding,
width = dropdownWidth,
options = skeys(ease.eases),
name = 'ease1'
})
ease.ease = ease.eases[d[dropdownId].options[d[dropdownId].selected]].f
elseif d[dropdownId].selected == 2 then -- mix eases
insertDropdown(d, {
x = padding + 128 + padding,
y = padding,
width = 128,
x = outerpadding + dropdownWidth + padding,
y = outerpadding,
width = dropdownWidth,
options = skeys(ease.eases),
name = 'ease1'
})
insertDropdown(d, {
x = padding + 128 + padding + 128 + padding,
y = padding,
width = 128,
x = outerpadding + dropdownWidth + padding + dropdownWidth + padding,
y = outerpadding,
width = dropdownWidth,
options = skeys(ease.eases),
name = 'ease2'
})
ease.ease = ease.mixEase(ease.eases[d[dropdownId - 1].options[d[dropdownId - 1].selected]].f, ease.eases[d[dropdownId].options[d[dropdownId].selected]].f, mixpoint)
elseif d[dropdownId].selected == 3 then -- create eases
insertDropdown(d, {
x = padding + 128 + padding,
y = padding,
width = 128,
x = outerpadding + dropdownWidth + padding,
y = outerpadding,
width = dropdownWidth,
options = skeys(ease.eases),
name = 'ease1'
})

View file

@ -25,9 +25,9 @@ function self.render()
if mode == 1 or mode == 2 then
local csize = 10 -- preview point size
local size = math.min((sw - padding) - ((dropdown.kget('ease2') or dropdown.kget('ease1')).x + 128 + padding), sh - padding * 5 - 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 - padding - size, padding, size, size
local x, y, w, h = sw - outerpadding - size, outerpadding, size, size
love.graphics.setColor(1, 1, 1, 1)
love.graphics.rectangle('line', x, y, w, h)

View file

@ -10,12 +10,12 @@ graph = require 'graph'
require 'util' -- exports into global table
-- eases
-- rendering constants
padding = 6
margin = 4
padding = 14
outerpadding = 22
margin = 6
dropdownWidth = 106
-- slider
@ -58,13 +58,13 @@ function love.draw()
love.graphics.rectangle('line', 0, 0, sw, sh)
love.graphics.setColor(1, 1, 1, 1)
love.graphics.print('Box of Eases by oatmealine', padding, sh - love.graphics.getFont():getHeight() - padding)
love.graphics.print('Box of Eases by oatmealine', outerpadding, sh - love.graphics.getFont():getHeight() - outerpadding)
-- sliders
-- yeah we do a lil' hardcoding
if mode == 2 then
local x, y, w, h = padding, padding * 2 + love.graphics.getFont():getHeight() + margin, 128, 32
local x, y, w, h = outerpadding, outerpadding * 2 + love.graphics.getFont():getHeight() + margin, dropdownWidth, 32
love.graphics.setColor(0.7, 0.7, 0.7, 0.4)
love.graphics.line(x, y + h/2, x + w, y + h/2)