-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.lua
More file actions
44 lines (33 loc) · 1.08 KB
/
main.lua
File metadata and controls
44 lines (33 loc) · 1.08 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 'dependencies'
function love.load()
love.window.setMode(WINDOW_WIDTH, WINDOW_HEIGHT, { borderless = true })
love.mouse.setVisible(false)
PassedLevels = {}
GameState = StateMachine {
['start'] = function() return StartState() end,
['play'] = function() return PlayState() end
}
GameState: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)
GameState:update(dt)
love.keyboard.keysPressed = {}
end
function love.draw()
love.graphics.setLineWidth(1)
love.graphics.setBackgroundColor(BACKGROUND_COLOR)
love.graphics.setFont(FontPrimarySmall)
love.graphics.scale(WINDOW_WIDTH / VIRTUAL_WIDTH, WINDOW_HEIGHT / VIRTUAL_HEIGHT)
GameState:render()
love.graphics.setColor(FPS_COLOR)
love.graphics.setFont(FontPrimarySmall)
love.graphics.print('FPS: ' .. tostring(love.timer.getFPS()), 40, 40)
love.graphics.setColor(WHITE)
end