unhardcode modes

This commit is contained in:
jill 2021-09-19 01:11:44 +03:00
parent 263259c2f5
commit c44579b508
3 changed files with 10 additions and 4 deletions

View file

@ -46,7 +46,7 @@ end
function self.render()
local sw, sh = love.graphics.getDimensions()
if mode == 1 or mode == 2 then
if mode == modes.preview or mode == modes.mix then
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)
@ -65,7 +65,7 @@ function self.render()
end
-- mixease point
if mode == 2 and slider.kget('mix') then
if mode == modes.mix and slider.kget('mix') then
love.graphics.setColor(1, 1, 1, 0.2 + self.touchtimer * 0.6)
love.graphics.line(x + margin + slider.kvalue('mix') * w, y, x + margin + slider.kvalue('mix') * w, y + h)
end

View file

@ -12,6 +12,12 @@ slider = require 'slider'
dropdown = require 'dropdown'
graph = require 'graph'
modes = {
preview = 1,
mix = 2,
create = 3
}
function createUI()
dropdown.createDropdowns()
slider.createSliders()

View file

@ -38,7 +38,7 @@ function self.createSliders()
local s = {}
sliderId = 0
if mode == 2 then -- mix eases
if mode == modes.mix then -- mix eases
insertSlider(s, {
x = outerpadding,
y = outerpadding + fontHeight * 2.5 + padding,
@ -50,7 +50,7 @@ function self.createSliders()
displayname = 'Mix'
})
end
if mode == 1 or mode == 2 then -- bpm slider
if mode == modes.preview or mode == modes.mix then -- bpm slider
insertSlider(s, {
x = outerpadding,
y = love.graphics.getHeight() - outerpadding - fontHeight * 3 - padding,