-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
42 lines (31 loc) · 791 Bytes
/
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
require('src.letterbox')
require('src.state_mainmenu')
local curGameState
function love.load()
local winW, winH = 1024, 768
LetterboxInit(winW, winH)
love.window.setMode(winW, winH) -- may fail
love.window.setVSync(1)
curGameState = State_MainMenu
curGameState:init()
end
function love.update(dt)
local newState = curGameState:update(dt)
if newState ~= nil then
curGameState:fini()
curGameState = newState
curGameState:init()
end
end
function love.keypressed(key, scancode, isrepeat)
curGameState:keypressed(key, scancode, isrepeat)
end
function love.draw()
LetterboxStart()
curGameState:draw()
LetterboxFinish()
end
function love.quit()
curGameState:fini()
return false -- Do not abort quit
end