-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.moon
More file actions
56 lines (44 loc) · 1.27 KB
/
main.moon
File metadata and controls
56 lines (44 loc) · 1.27 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
export LOG = assert require 'lib/log'
assert require 'src/Dependencies'
loveframes = assert require 'lib/loveframes'
export DEBUG_ENABLED = false
LOG.setShowFileInfo false
with love
.load = (args) ->
Graphics.setDefaultFilter 'nearest', 'nearest'
G_stateMachine\change 'debug', {
loveframes: loveframes
}
Keyboard.keysPressed = {}
.update = (dt) ->
G_stateMachine\update dt
Keyboard.keysPressed = {}
loveframes.update dt
.draw = () ->
G_stateMachine\draw!
loveframes.draw!
.mousepressed = (x, y, button) ->
loveframes.mousepressed x, y, button
.keypressed = (key, is_r) ->
Keyboard.keysPressed[key] = true
loveframes.keypressed key, is_r
.mousepressed = (x, y, button) ->
loveframes.mousepressed x, y, button
.mousereleased = (x, y, button) ->
loveframes.mousereleased x, y, button
.wheelmoved = (x, y) ->
loveframes.wheelmoved x, y
.keyreleased = (key) ->
loveframes.keyreleased key
if key == "f1"
debug = loveframes.config["DEBUG"]
loveframes.config["DEBUG"] = not debug
elseif key == "escape"
love.event.quit!
.textinput = (text) ->
loveframes.textinput text
Keyboard.wasPressed = (key) ->
if Keyboard.keysPressed[key]
return true
else
return false