-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.lua
62 lines (58 loc) · 1.52 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
require('globals')
local Game = require('Classes.Game')
local game
function love.load()
if arg[#arg] == '-debug' then require('mobdebug').start() end -- Zerobrane studio debugging.
settings:load()
game = Game()
end
function love.update(dt)
console:update(dt)
if not console.input.active then
game:update(dt)
end
end
function love.draw()
game:draw()
-- Dev:
-- console:draw()
-- love.graphics.setColor(1, 1, 1)
-- love.graphics.print(love.timer.getFPS(), 150, 10)
end
function love.keypressed(key)
-- console:keypressed(key)
if not console.input.active then
game:keypressed(key)
end
-- Toggle fullscreen
local toggleFull = function ()
local _, _, flags = love.window.getMode()
local width, height = 0, 0
love.window.setMode(width, height, { fullscreen = not flags.fullscreen })
end
if love.keyboard.isDown('lalt') or love.keyboard.isDown('ralt') then
if key == 'return' or key == 'enter' then
toggleFull()
end
elseif key == 'f11' then
toggleFull()
end
-- Dev
if love.keyboard.isDown('ralt') or love.keyboard.isDown('lalt') then
if key == 'f4' then
love.event.quit()
end
end
end
function love.mousepressed(x, y, button)
game:mousepressed(x, y, button)
end
function love.mousereleased(x, y, button)
game:mousereleased(x, y, button)
end
function love.wheelmoved(x, y)
game:wheelmoved(x, y)
end
function love.resize(w, h)
game:resize(w, h)
end