-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathingame_menu.lua
73 lines (65 loc) · 1.62 KB
/
ingame_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
63
64
65
66
67
68
69
70
71
72
73
ingame_menu = {}
local lg = love.graphics
function ingame_menu.enter()
playSound("blip")
state = STATE_INGAME_MENU
ingame_menu.selection = 1
end
function ingame_menu.update(dt)
updateKeys()
end
function ingame_menu.draw()
lg.push()
ingame.draw()
lg.pop()
lg.scale(config.scale)
lg.setColor(0,0,0,238/255)
lg.rectangle("fill", 0, 0, WIDTH, HEIGHT)
lg.setColor(1,1,1,1)
lg.printf("PAUSED", 0, 46, WIDTH, "center")
lg.print("RESUME", 103, 92)
lg.print("QUIT", 103, 106)
lg.print(">", 92, 77+ingame_menu.selection*14)
end
function ingame_menu.keypressed(k, uni)
if k == "down" then
ingame_menu.selection = wrap(ingame_menu.selection+1, 1,2)
playSound("blip")
elseif k == "up" then
ingame_menu.selection = wrap(ingame_menu.selection-1, 1,2)
playSound("blip")
elseif k == " " or k == "return" then
if ingame_menu.selection == 1 then
state = STATE_INGAME
playSound("confirm")
elseif ingame_menu.selection == 2 then
mainmenu.enter()
playSound("confirm")
playMusic("opening")
end
elseif k == "escape" then
state = STATE_INGAME
playSound("blip")
end
end
function ingame_menu.action(k)
if k == "down" then
ingame_menu.selection = wrap(ingame_menu.selection+1, 1,2)
playSound("blip")
elseif k == "up" then
ingame_menu.selection = wrap(ingame_menu.selection-1, 1,2)
playSound("blip")
elseif k == "pause" or k == "jump" then
if ingame_menu.selection == 1 then
state = STATE_INGAME
playSound("confirm")
elseif ingame_menu.selection == 2 then
mainmenu.enter()
playSound("confirm")
playMusic("opening")
end
elseif k == "action" then
state = STATE_INGAME
playSound("blip")
end
end