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