-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
55 lines (41 loc) · 955 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
43
44
45
46
47
48
49
50
51
52
53
54
55
require("src.StateMachine")
local push = require("libs.push")
function love.load()
WINDOW_WIDTH = 1280
WINDOW_HEIGHT = 720
VIRTUAL_WIDTH = 512
VIRTUAL_HEIGHT = 288
gStateMachine = StateMachine:new({})
gStateMachine:change("")
love.keyboard.keysPressed = {}
math.randomseed(os.time())
push:setupScreen(
VIRTUAL_WIDTH,
VIRTUAL_HEIGHT,
WINDOW_WIDTH,
WINDOW_HEIGHT,
{
vsync = true,
fullscreen = false,
resizable = true
}
)
end
function love.update(dt)
gStateMachine:update(dt)
love.keyboard.keysPressed = {}
end
function love.draw()
push:start()
gStateMachine:render()
push:finish()
end
function love.keypressed(key)
love.keyboard.keysPressed[key] = true
end
function love.keyboard.wasPressed(key)
return love.keyboard.keysPressed[key]
end
function love.resize(w, h)
push:resize(w, h)
end