-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
54 lines (48 loc) · 1.11 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
function love.load()
love.filesystem.load('load.lua')()
mainmenuLoad()
end
function love.update(dt)
if gameState == 'ingame' then
ingameUpdate(dt)
elseif gameState == 'mainmenu' then
mainmenuUpdate(dt)
elseif gameState == 'pause' then
pauseUpdate(dt)
end
end
function love.keypressed(key)
if gameState == 'ingame' then
ingameKeypressed(key)
elseif gameState == 'mainmenu' then
mainmenuKeypressed(key)
elseif gameState == 'pause' then
pauseKeypressed(key)
end
end
function love.mousepressed(x, y, button)
if gameState == 'mainmenu' then
end
end
function love.mousereleased(x, y, button)
if button == 1 and gameState == 'mainmenu' or gameState == 'pause' then
local x, y = love.mouse.getPosition()
for _, b in pairs(B) do
if x > b.x and x < b.dx and y > b.y and y < b.dy then
b.action()
break
end
end
end
end
function love.draw()
if gameState == 'ingame' then
camera:action()
drawinterface()
elseif gameState == 'mainmenu' then
mainmenuDraw()
elseif gameState == 'pause' then
camera:action()
pauseDraw()
end
end