Update pygameControls/logitech_f710_controller.py
This commit is contained in:
@@ -14,15 +14,7 @@ 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 ConnectionType(Enum):
|
|
||||||
WIRED = 1
|
|
||||||
WIRELESS = 2
|
|
||||||
|
|
||||||
class LogitechF710Controller(ControlsBase):
|
class LogitechF710Controller(ControlsBase):
|
||||||
def __init__(self, joy, connection_type):
|
def __init__(self, joy, connection_type):
|
||||||
@@ -30,14 +22,13 @@ class LogitechF710Controller(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_numaxis()
|
self.numaxis: int = self.device.get_numaxis()
|
||||||
self.axis: list = []
|
self.axis: list = []
|
||||||
self.numhats: int = self.device.get_numhats()
|
self.numhats: int = self.device.get_numhats()
|
||||||
self.hats: list = []
|
self.hats: list = []
|
||||||
self.numbuttons: int = self.device.get_numbuttons()
|
self.numbuttons: int = self.device.get_numbuttons()
|
||||||
self.buttons: list = []
|
self.buttons: list = []
|
||||||
self.input_mode: InputMode.DirectInput
|
|
||||||
self.mapping = {
|
self.mapping = {
|
||||||
"l1 button": 4,
|
"l1 button": 4,
|
||||||
"r1 button": 5,
|
"r1 button": 5,
|
||||||
@@ -52,6 +43,7 @@ class LogitechF710Controller(ControlsBase):
|
|||||||
"logo button": 8
|
"logo button": 8
|
||||||
}
|
}
|
||||||
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
|
||||||
@@ -112,18 +104,3 @@ class LogitechF710Controller(ControlsBase):
|
|||||||
def buttons(self) -> None:
|
def buttons(self) -> None:
|
||||||
self._buttons = [self.device.get_buttons(b) for b in range(self.numbuttons)]
|
self._buttons = [self.device.get_buttons(b) for b in range(self.numbuttons)]
|
||||||
|
|
||||||
@property
|
|
||||||
def input_mode(self) -> int:
|
|
||||||
return self._inputmode
|
|
||||||
|
|
||||||
@input_mode.setter
|
|
||||||
def input_mode(self, mode: int) -> None:
|
|
||||||
self._inputmode = mode
|
|
||||||
|
|
||||||
@property
|
|
||||||
def input_connection(self) -> int:
|
|
||||||
return self._input_connection
|
|
||||||
|
|
||||||
@input_connection.setter
|
|
||||||
def input_connection(self, conn: int) -> None:
|
|
||||||
self._input_connection = conn
|
|
Reference in New Issue
Block a user