85 lines
No EOL
1.7 KiB
Lua
85 lines
No EOL
1.7 KiB
Lua
local default_G = {}
|
|
for k, v in pairs(_G) do
|
|
table.insert(default_G, k)
|
|
end
|
|
|
|
ease = require 'ease'
|
|
|
|
slider = require 'slider'
|
|
dropdown = require 'dropdown'
|
|
graph = require 'graph'
|
|
|
|
function createUI()
|
|
dropdown.createDropdowns()
|
|
slider.createSliders()
|
|
end
|
|
|
|
require 'util' -- exports into global table
|
|
|
|
-- rendering constants
|
|
|
|
padding = 14
|
|
outerpadding = 22
|
|
margin = 6
|
|
dropdownWidth = 106
|
|
fontHeight = love.graphics.getFont():getHeight()
|
|
|
|
-- global for convinience's sake
|
|
|
|
mode = nil
|
|
|
|
function love.load()
|
|
fontHeight = love.graphics.getFont():getHeight()
|
|
createUI()
|
|
end
|
|
|
|
function love.update(dt)
|
|
graph.update(dt)
|
|
slider.update(dt)
|
|
dropdown.update(dt)
|
|
end
|
|
|
|
function love.draw()
|
|
local sw, sh = love.graphics.getDimensions()
|
|
local mx, my = love.mouse.getPosition()
|
|
|
|
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)
|
|
|
|
love.graphics.setColor(1, 1, 1, 1)
|
|
love.graphics.print('Box of Eases by oatmealine', outerpadding, sh - fontHeight - outerpadding)
|
|
|
|
slider.render()
|
|
|
|
dropdown.render()
|
|
|
|
graph.render()
|
|
end
|
|
|
|
function love.mousepressed(x, y, m)
|
|
if dropdown.mousepressed(x, y, m) then return end
|
|
end
|
|
|
|
function love.mousereleased(x, y, m)
|
|
if dropdown.mousereleased(x, y, m) then return end
|
|
end
|
|
|
|
function love.wheelmoved(x, y)
|
|
if y == 0 then return end
|
|
|
|
if dropdown.wheelmoved(x, y) then return end
|
|
end
|
|
|
|
function love.keypressed(key)
|
|
if key == 'f6' then -- print all globals
|
|
for k, v in pairs(_G) do
|
|
for _, g in ipairs(default_G) do
|
|
if g == k then goto continue end
|
|
end
|
|
print(k, v)
|
|
::continue::
|
|
end
|
|
end
|
|
end |