-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
71 lines (55 loc) · 1.09 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require("game/Game")
require("menu/MainMenu")
require("FontManager")
require("AudioManager")
require("HighscoreManager")
game = nil
mainMenu = nil
function love.load()
-- ZeroBrane debugger
if arg[#arg] == "-debug" then require("mobdebug").start() end
-- Setup window
love.window.setMode(1280, 720);
love.window.setTitle("Lua Snakes")
-- Load Assets
FontManager.init()
AudioManager.init()
HighscoreManager.init()
-- Init MainMenu
mainMenu = MainMenu()
gotoMenu()
end
-- goto calls
function startGame(game)
currentScene = game
end
function gotoMenu()
currentScene = mainMenu
end
function gotoHighscore()
mainMenu:gotoHighscore()
currentScene = mainMenu
end
function love.draw()
currentScene:draw()
end
function love.update(dt)
KeyboardManager.update()
currentScene:update(dt)
end
-- text grabbing function
grabbedText = ""
grabText = false
function startGrabbingText()
grabText = true
grabbedText = ""
end
function stopGrabbingText()
grabText = false
grabbedText = ""
end
function love.textinput(t)
if grabText then
grabbedText = grabbedText .. t
end
end