Update pygameControls/xbox_series_x_controller.py
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
from pygameControls.controlsbase import ControlsBase
|
from pygameControls.controlsbase import ControlsBase
|
||||||
|
from enums import ConnectionType
|
||||||
|
import pygame
|
||||||
|
|
||||||
class XboxSeriesXController(ControlsBase):
|
class XboxSeriesXController(ControlsBase):
|
||||||
def __init__(self, joy, connection_type):
|
def __init__(self, joy, connection_type):
|
||||||
@@ -6,7 +8,7 @@ class XboxSeriesXController(ControlsBase):
|
|||||||
self.instance_id: int = self.device.get_instance_id()
|
self.instance_id: int = self.device.get_instance_id()
|
||||||
self.name = self.device.get_name()
|
self.name = self.device.get_name()
|
||||||
self.guid = self.device.get_guid()
|
self.guid = self.device.get_guid()
|
||||||
self.connection_type = connection_type
|
self.connection_type = ConnectionType(connection_type.values())
|
||||||
self.numaxis: int = self.device.get_numaxes()
|
self.numaxis: int = self.device.get_numaxes()
|
||||||
self.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
|
self.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
|
||||||
self.numhats: int = self.device.get_numhats()
|
self.numhats: int = self.device.get_numhats()
|
||||||
@@ -28,6 +30,7 @@ class XboxSeriesXController(ControlsBase):
|
|||||||
"copy button": 10
|
"copy button": 10
|
||||||
}
|
}
|
||||||
print(f"{self.name} connected.")
|
print(f"{self.name} connected.")
|
||||||
|
print(f"Connection type: {connection_type.capitalize()}")
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.device.quit()
|
self.device.quit()
|
||||||
|
Reference in New Issue
Block a user