This repository has been archived by the owner on Jun 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.lua
103 lines (76 loc) · 2.11 KB
/
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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
love.filesystem.load('requirements.lua')()
function love.load(args)
local k_args = {}
for _,arg in ipairs(args) do
local key, value = arg:match("(.*)=(.*)")
key, value = key or arg, value or true
k_args[key] = value
end
-- local gameWidth, gameHeight = love.graphics.getDimensions()
-- local windowWidth, windowHeight = love.window.getDesktopDimensions()
-- local windowWidth, windowHeight = 1920, 1080
-- push:setupScreen(gameWidth, gameHeight, windowWidth, windowHeight, {fullscreen=false})
game = Game:new(k_args)
end
function love.update(dt)
game:update(dt)
end
function love.mousepressed(x, y, button, isTouch)
game:mousepressed(x, y, button, isTouch)
end
function love.mousereleased(x, y, button, isTouch)
game:mousereleased(x, y, button, isTouch)
end
function love.wheelmoved(x, y)
game:wheelmoved(x, y)
end
function love.keypressed(key, scancode, isrepeat)
game:keypressed(key, scancode, isrepeat)
if key == "escape" then
love.event.push("quit")
end
end
function love.keyreleased(key, scancode)
game:keyreleased(key, scancode)
end
function love.joystickpressed(joystick, button)
game:joystickpressed(joystick, button)
end
function love.joystickreleased(joystick, button)
game:joystickreleased(joystick, button)
end
function love.gamepadaxis(joystick, axis, value)
game:gamepadaxis(joystick, axis, value)
end
function love.gamepadpressed(joystick, button)
game:gamepadpressed(joystick, button)
end
function love.gamepadreleased(joystick, button)
game:gamepadreleased(joystick, button)
end
function love.joystickadded(joystick)
game:joystickadded(joystick)
end
function love.joystickremoved(joystick)
game:joystickremoved(joystick)
end
function love.joystickaxis(joystick, axis, value)
game:joystickaxis(joystick, axis, value)
end
function love.joystickhat(joystick, hat, direction)
game:joystickhat(joystick, hat, direction)
end
function love.textinput(text)
game:textinput(text)
end
function love.draw()
-- push:start()
game:draw()
-- push:finish()
end
function love.focus(has_focus)
game:focus(has_focus)
end
function love.quit()
game:quit()
end