Update pygameControls/sony_playstation3_controller.py

This commit is contained in:
2025-05-05 09:31:48 +02:00
parent 803df7e087
commit 3f9dfec413

View File

@@ -1,4 +1,6 @@
from pygameControls.controlsbase import ControlsBase
from enums import ConnectionType
import pygame
class SonyPlayStation3Controller(ControlsBase):
def __init__(self, joy, connection_type):
@@ -6,7 +8,7 @@ class SonyPlayStation3Controller(ControlsBase):
self.instance_id: int = self.device.get_instance_id()
self.name = self.device.get_name()
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.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
self.numhats: int = self.device.get_numhats()
@@ -31,6 +33,7 @@ class SonyPlayStation3Controller(ControlsBase):
"right button": 16
}
print(f"{self.name} connected.")
print(f"Connection type: {connection_type.capitalize()}")
def close(self):
self.device.quit()