-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
62 lines (51 loc) · 1.15 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
local lg = love.graphics
local WIDTH = lg:getWidth()
local HEIGHT = lg:getHeight()
local HALF_WIDTH = WIDTH * 0.5
local HALF_HEIGHT = HEIGHT * 0.5
color = require('src/color')
grid = require('src/grid')
local panel = require('src/panel')
local camera = require('src/camera')
function love.load()
love.keyboard.setKeyRepeat(true)
color:init(require('src/colors'))
panel:load()
grid:load()
camera:setPosition(grid.halfWidth - HALF_WIDTH, grid.halfHeight - HALF_HEIGHT)
camera:setBoundaries {
minX = 0,
minY = 0,
maxX = grid.width,
maxY = grid.height,
}
color:setBackground('white-light')
end
function love.update(dt)
if (not panel.visible) then
camera:update(dt)
end
panel:update(dt)
end
local coords = {}
function love.draw()
camera:set()
grid:draw()
camera:unset()
panel:draw()
end
function love.mousereleased(x, y, button)
panel:mousereleased(x, y, button)
end
function love.mousepressed(x, y, button)
panel:mousepressed(x, y, button)
end
function love.keypressed(key)
panel:keypressed(key)
end
function love.textinput(key)
panel:textinput(key)
end
function love.wheelmoved(x, y)
camera:wheelmoved(x, y)
end