-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
81 lines (62 loc) · 1.54 KB
/
Copy pathmain.lua
File metadata and controls
81 lines (62 loc) · 1.54 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
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
72
73
74
75
76
77
78
79
80
81
local push = require("vendor.push.push")
local assets = require("assets")
local scenes = require("lib.scenes")
local keys = require("lib.keys")
local inspect = require("vendor.inspect")
require("logic.constants")
INSPECT = function(...)
print(inspect({ ... }))
return ...
end
love.graphics.setDefaultFilter("nearest", "nearest")
push:setupScreen(
GAME_WIDTH,
GAME_HEIGHT,
WINDOW_SCALE_FACTOR * GAME_WIDTH,
WINDOW_SCALE_FACTOR * GAME_HEIGHT,
{ fullscreen = false, pixelperfect = true, resizable = true }
)
local function load()
keys.configure(BINDINGS)
assets.load()
scenes.init("scenes/", "game")
end
love.load = load
local function keypressed(key)
if keys.toAction(key) then
scenes.keypressed(keys.toAction(key))
end
end
love.keypressed = keypressed
local function keyreleased(key)
if keys.toAction(key) then
scenes.keyreleased(keys.toAction(key))
end
end
love.keyreleased = keyreleased
local function mousepressed(x, y, button)
if keys.toAction("mouse" .. button) then
scenes.mousepressed(x, y, keys.toAction("mouse" .. button))
end
end
love.mousepressed = mousepressed
local function mousereleased(x, y, button)
if keys.toAction("mouse" .. button) then
scenes.mousereleased(x, y, keys.toAction("mouse" .. button))
end
end
love.mousereleased = mousereleased
local function resize(w, h)
return push:resize(w, h)
end
love.resize = resize
local function update(dt)
scenes.update(dt)
end
love.update = update
local function draw()
push:start()
scenes.draw()
push:finish()
end
love.draw = draw