Update pygameControls/logitech_dual_action_controller.py

This commit is contained in:
2025-05-05 09:23:59 +02:00
parent 1c2565cf39
commit 8ac6883f17

View File

@@ -14,19 +14,15 @@ This controller is a usb controller, with the following features.
import pygame
from pygameControls.controlsbase import ControlsBase
from enum import Enum
from enums import ConnectionType
class InputMode(Enum):
DirectInput = 1
XInput = 2
class LogitechDualActionController(ControlsBase):
def __init__(self, joy, connection_type):
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 = connection_type
self.connection_type = ConnectionType(connection_type.values())
self.powerlevel = self.device.get_power_level()
self.numaxis: int = self.device.get_numaxes()
self.axis: list = [self.device.get_axis(a) for a in range(self.numaxis)]
@@ -34,7 +30,6 @@ class LogitechDualActionController(ControlsBase):
self.hats: list = [self.device.get_hat(h) for h in range(self.numhats)]
self.numbuttons: int = self.device.get_numbuttons()
self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)]
self.input_mode = InputMode.DirectInput
self.mapping = {
"r2 trigger": 7,
"l2 trigger": 6,
@@ -51,6 +46,7 @@ class LogitechDualActionController(ControlsBase):
"logo button": None
}
print(f"{self.name} connected.")
print(f"Connection type: {connection_type.capitalize()}")
def close(self):
pass