forked from Lydzje/lynput
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
82 lines (58 loc) · 1.69 KB
/
main.lua
File metadata and controls
82 lines (58 loc) · 1.69 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
82
function love.load()
Lynput = require("Lynput")
Lynput.load_key_callbacks()
Lynput.load_mouse_callbacks()
Lynput.load_gamepad_callbacks()
lynput = Lynput()
lynput:bind("exit", "release escape")
lynput:attachGamepad("GPAD_1")
lynput:bind("pressing", {"press p", "press LMB", "press G_A"})
lynput:bind("releasing", {"release r", "release RMB", "release G_B"})
lynput:bind("holding", {"hold h", "hold MMB", "hold G_X"})
lynput:unbindAll("holding")
lynput:bind("moveLeft", {"-100:-50 G_LEFTSTICK_X"})
lynput:bind("moveRight", {"50:100 G_LEFTSTICK_X"})
lynput:unbind("moveRight", "50:100 G_LEFTSTICK_X")
lynput:bind("RTing", "0:100 G_RT")
lynput:bind("pressAny", "press any")
lynput:bind("releaseAny", "release any")
lynput:bind("holdAny", "hold any")
end
function love.update(dt)
if lynput.exit then
love.event.quit()
end -- if exit
-- if lynput.pressAny then
-- print("Pressed ANY")
-- end --
-- if lynput.releaseAny then
-- print("Released ANY")
-- end --
-- if lynput.holdAny then
-- print("Holding ANY")
-- end
print(lynput:getAxis("righty"))
if lynput.pressing then
print("Pressing")
end -- if pressing
if lynput.releasing then
print("Releasing")
lynput:unbind("releasing", {"release r", "release RMB", "release G_B"})
end -- if releasing
if lynput.holding then
print("Holding")
end -- if holding
if lynput.moveLeft then
print("moving left")
end -- if moveLeft
if lynput.moveRight then
print("Moving right")
end -- if moveRight
if lynput.RTing then
print("RTing")
end -- if RTing
Lynput.update_(dt)
end
function love.draw()
love.graphics.setColor(255, 255, 255)
end