-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpause.lua
76 lines (56 loc) · 1.92 KB
/
pause.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
--the pause menu
pause = false
--menu items
pause_menu_items = {
"GRAPHICS",
"VOLUME",
"WORLD",
"EXIT"
}
pause_menu_submenu = nil
function pause_game()
local x, y = love.mouse.getPosition( )
local starter_y = 250
local ier = 0
pause_menu_submenu = nil
for _,item in pairs(pause_menu_items) do
if x > love.graphics.getWidth( )/2-(fontbig:getWidth(item)/2)-2 and love.graphics.getWidth( )/2-(fontbig:getWidth(item)/2)-2 +fontbig:getWidth(item) and
y > starter_y-9+(ier*100) and y < starter_y-9+(ier*100) + fontbig:getHeight(item) then
pause_menu_submenu = item
end
ier = ier + 1
end
--exit
if pause_menu_submenu == "EXIT" and love.mouse.isDown(1) then
maplib.save_chunks()
love.filesystem.write( "/map/player.txt", TSerial.pack({inventory,chunkx,chunky,player.playerx,player.playery}))
print("saving...")
love.timer.sleep(1)
love.event.push('quit')
end
end
function render_pause_menu()
--menu title
love.graphics.setColor(255,255,255,255)
love.graphics.setFont(hugefont)
love.graphics.print("GAME MENU", love.graphics.getWidth( )/2-(hugefont:getWidth("GAME MENU")/2),50)
--directories
local starter_y = 250
local ier = 0
for _,item in pairs(pause_menu_items) do
--selection
if pause_menu_submenu == item then
love.graphics.setColor(255,0,0,255)
love.graphics.rectangle( "fill", love.graphics.getWidth( )/2-(fontbig:getWidth(item)/2)-5, starter_y-9+(ier*100)-5,fontbig:getWidth(item)+10, fontbig:getHeight(item)+10 )
end
--
love.graphics.setColor(255,255,255,255)
love.graphics.rectangle( "fill", love.graphics.getWidth( )/2-(fontbig:getWidth(item)/2)-2, starter_y-9+(ier*100),fontbig:getWidth(item), fontbig:getHeight(item) )
---
love.graphics.setColor(0,0,0,255)
love.graphics.setFont(fontbig)
love.graphics.print(item, love.graphics.getWidth( )/2-(fontbig:getWidth(item)/2),starter_y+(ier*100))
ier = ier + 1
end
love.graphics.setColor(100,100,100,255)
end