-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.lua
More file actions
87 lines (50 loc) · 1.91 KB
/
menu.lua
File metadata and controls
87 lines (50 loc) · 1.91 KB
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
84
85
86
87
local Menu = {}
local Bigfont = love.graphics.newFont("fonts/bebasneueregular.ttf", 140 / 1280 * love.graphics.getWidth())
local Mediumfont = love.graphics.newFont("fonts/bebasneueregular.ttf", 60)
local Smallfont = love.graphics.newFont("fonts/bebasneueregular.ttf", 20)
local button = require("button")
local textbutton = require("textbutton")
local sett = require("settings")
local game = require("game")
local mousex, mousey
function Menu.load()
--Display the menu first when the game is launched
gamestate = "menu"
background = love.graphics.newImage("images/background.jpg")
mousex = 0
mousey = 0
local WindowWidth = love.graphics.getWidth()
local WindowHeight = love.graphics.getHeight( )
end
function Menu.update(dt)
mousex, mousey = love.mouse.getPosition()
end
function Menu.draw()
--**BACKGROUND**--
love.graphics.draw(background, -20 + mousex / 100,-20 + mousey / 100)
--**BACKGROUND**--
--FPS
love.graphics.setNewFont(12)
love.graphics.setColor(1,1,1)
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10)
--FPS
love.graphics.setFont(Bigfont)
love.graphics.print("THE GAME",WindowWidth / 2 - (Bigfont:getWidth( "THE GAME" ) / 2) ,WindowHeight / 6)
textbutton.new(WindowWidth / 2 - Mediumfont:getWidth("New Game") / 2,WindowHeight / 2.8,"New Game","ffffff","888888",newgame,"game")
textbutton.new(WindowWidth / 2 - Mediumfont:getWidth("Continue") / 2,WindowHeight / 2.2,"Continue","ffffff","888888",continue,"next")
textbutton.new(WindowWidth / 2 - Mediumfont:getWidth("Settings") / 2,WindowHeight / 1.8,"Settings","ffffff","888888",settings,"settings")
end
function newgame()
--**START A NEW GAME**--
gamestate = "game" --Changing the main game loop gamestate
print("New game started, save override")
game.load()
end
function continue()
print("continue")
end
function settings()
gamestate = "settings"
sett.load()
end
return Menu