Update pygameControls/sony_playstation3_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 SonyPlayStation3Controller(ControlsBase):
|
class SonyPlayStation3Controller(ControlsBase):
|
||||||
def __init__(self, joy, connection_type):
|
def __init__(self, joy, connection_type):
|
||||||
@@ -6,7 +8,7 @@ class SonyPlayStation3Controller(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()
|
||||||
@@ -31,6 +33,7 @@ class SonyPlayStation3Controller(ControlsBase):
|
|||||||
"right button": 16
|
"right button": 16
|
||||||
}
|
}
|
||||||
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