-
Notifications
You must be signed in to change notification settings - Fork 0
/
menu.lua
executable file
·62 lines (57 loc) · 1.2 KB
/
menu.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 menu = {}
function menu:load()
self.buttons = {}
self.buttons = env.butt.new(
self.buttons,
{
txt = "Play",
aligne = "center",
y = 200,
paddingLeft = 50,
callback = function()
env.page = 1
love.audio.stop(env.sounds.sound1)
if env.game.start == 0 then
env.game = dofile("game.lua"):new()
end
end
}
)
self.buttons = env.butt.new(
self.buttons,
{
txt = "Setting",
aligne = "center",
y = 300,
paddingLeft = 25,
callback = function() env.page = -1 end
}
)
self.buttons = env.butt.new(
self.buttons,
{
txt = "Exit",
aligne = "center",
y = 500,
paddingLeft = 50,
callback = function() os.exit(0) end
}
)
return self
end
function menu.update(dt)
if env.sound then
love.audio.play(env.sounds.sound1)
end
end
function menu:mousepressed(x, y, bt)
env.butt.mousepressed(menu.buttons, x, y, bt)
end
function menu:draw()
love.graphics.setColor(255, 255, 255, 255)
love.graphics.setBackgroundColor(42,42,42)
love.graphics.setFont(env.bigFont)
love.graphics.print('Break Portal', love.window.getWidth() / 2 - 150, 60)
env.butt.draw(menu.buttons)
end
return menu