-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
36 lines (27 loc) · 874 Bytes
/
main.py
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
from inputs import devices
from Controller.Controller import Controller
from defaultlistener import DefaultListener
controllers: list[Controller] = []
count = 0
def create_controller(device):
"""
Creates new gamepad.
"""
global count
# State manager for the controller.
state = {'alive': True, 'sleep': False, 'interrupt': False}
controllers.append(Controller(device, count, state, DefaultListener(state, count, device.set_vibration)))
count += 1
def main():
for device in devices:
if device.device_type == 'joystick':
create_controller(device)
if count == 0:
input('No controller found.\nPress enter to exit.')
exit(0)
for controller in controllers:
controller.join()
if __name__ == "__main__":
from LogHandler.logger import redirect_error
redirect_error()
main()