forked from digiholic/universalSmashSystem
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjoyTest.py
More file actions
53 lines (43 loc) · 1.16 KB
/
joyTest.py
File metadata and controls
53 lines (43 loc) · 1.16 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
import pygame
import collections
print "Joystick Test"
pygame.init()
pygame.joystick.init()
joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())]
print joysticks
j = joysticks[0]
print j.get_init()
print j.get_id()
j.init()
# print j.get_init()
# print j.get_id()
# print j.get_numaxes()
# a = [set() for axis in range(j.get_numaxes())]
# print j.get_numbuttons()
# b = [set() for button in range(j.get_numbuttons())]
while True:
e = pygame.event.get()
# if len(e) != 0:
# print len(e)
for event in e:
if event.type == pygame.JOYBUTTONDOWN:
# n = event.joy
# for axis in range(j.get_numaxes()):
# print len(a[axis])
# for button in range(j.get_numbuttons()):
# print j.get_button(button)
# print '\n'
print "JOYBUTTONDOWN"
print "joy: ", event.joy
print "button: ", event.button
if event.type == pygame.JOYAXISMOTION:
# n = event.axis
# a[n].add(event.value)
print "JOYAXISMOTION"
print "joy: ", event.joy
print "axis: ", event.axis
print "value: ", event.value
if event.type == pygame.JOYBUTTONUP:
print "JOYBUTTONUP"
print "joy: ", event.joy
print "button: ", event.button