-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.lua
83 lines (64 loc) · 1.41 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
MOBILE = (love.system.getOS() == "Android")
DEBUG = false
local G = love.graphics
-- compatibility
do
local a, b, c = love.getVersion()
VERSION = a ..".".. b ..".".. c
end
love.mouse.setVisible(false)
G.setDefaultFilter("nearest", "nearest")
G.setBackgroundColor(0, 0, 0, 0)
require "helper"
require "input"
require "font"
require "stars"
require "walls"
require "particle"
require "player"
require "item"
require "enemy"
require "boom"
require "sound"
require "game"
require "menu"
QuadGenerator:GenerateQuads()
font = Font()
game = Game()
menu = Menu()
state = menu
keyboard = Input()
--bg_music = love.audio.newSource("media/music.ogg", "stream")
--bg_music:setLooping(true)
function love.update()
updateList(Input.list)
state:update()
-- fast forward
if love.keyboard.isDown("backspace") then
for i = 1, 20 do state:update() end
end
-- screenshots
-- if love.keyboard.isDown("p") then
-- t = t and t + 1 or 0
-- G.captureScreenshot(("%05d.png"):format(t))
-- end
end
function love.draw()
state:draw()
-- G.setColor(1, 1, 1)
-- G.print(love.timer.getFPS(), 10, 40)
end
function love.keypressed(key)
keyboard:keypressed(key)
if state.keypressed then state:keypressed(key) end
-- if key == "tab" then DEBUG = not DEBUG end
end
function love.resize()
Boom.canvas = G.newCanvas()
Game.canvas = G.newCanvas()
end
function love.focus(f)
if f == false and state == game then
game:setPause(true)
end
end