GUID identification used to determine gamepad. /JL

This commit is contained in:
2025-05-06 20:47:01 +02:00
parent e99f8f761c
commit e02148c937
20 changed files with 287 additions and 204 deletions

View File

@@ -3,13 +3,11 @@ from enums import ConnectionType, InputType
import pygame
class Xbox360Controller(ControlsBase):
def __init__(self, joy, connection_type):
def __init__(self, joy):
self.device = joy
self.instance_id: int = self.device.get_instance_id()
self.name = self.device.get_name()
self.guid = self.device.get_guid()
self.connection_type = ConnectionType(connection_type.values())
self.input_type = InputType.XInput
self.numaxis: int = self.device.get_numaxes()
self.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
self.numhats: int = self.device.get_numhats()
@@ -31,7 +29,6 @@ class Xbox360Controller(ControlsBase):
"copy button": 10
}
print(f"{self.name} connected.")
print(f"Connection type: {connection_type.capitalize()}")
def close(self):
self.device.quit()