forked from DonLarry/GLAN-JHR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
44 lines (35 loc) · 1.04 KB
/
main.lua
File metadata and controls
44 lines (35 loc) · 1.04 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
require 'settings'
function love.load()
math.randomseed(os.time())
love.window.setTitle(GAME_TITLE)
love.graphics.setDefaultFilter('nearest', 'nearest')
push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, {
fullscreen = false,
resizable = false
})
stateMachine = StateMachine {
['start'] = function() return StartState() end,
['play'] = function() return PlayState() end,
['pause'] = function() return PauseState() end,
['game-over'] = function() return GameOverState() end,
['win'] = function() return WinState() end
}
stateMachine:change('start')
love.keyboard.keysPressed = {}
end
function love.keypressed(key)
love.keyboard.keysPressed[key] = true
end
function love.keyboard.wasPressed(key)
return love.keyboard.keysPressed[key]
end
function love.update(dt)
Timer.update(dt)
stateMachine:update(dt)
love.keyboard.keysPressed = {}
end
function love.draw()
push:start()
stateMachine:render()
push:finish()
end