Update pygameControls/logitech_f510_controller.py
This commit is contained in:
@@ -14,30 +14,21 @@ 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 ConnectionType(Enum):
|
||||
WIRED = 1
|
||||
WIRELESS = 2
|
||||
|
||||
class LogitechF510Controller(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.numaxis: int = self.device.get_numaxis()
|
||||
self.axis: list = []
|
||||
self.numhats: int = self.device.get_numhats()
|
||||
self.hats: list = []
|
||||
self.numbuttons: int = self.device.get_numbuttons()
|
||||
self.buttons: list = []
|
||||
self.input_mode: InputMode.DirectInput
|
||||
self.mapping = {
|
||||
"l1 button": 4,
|
||||
"r1 button": 5,
|
||||
@@ -52,6 +43,7 @@ class LogitechF510Controller(ControlsBase):
|
||||
"logo button": 8
|
||||
}
|
||||
print(f"{self.name} connected.")
|
||||
print(f"Connection type: {connection_type.capitalize()}")
|
||||
|
||||
def close(self):
|
||||
pass
|
||||
@@ -111,19 +103,4 @@ class LogitechF510Controller(ControlsBase):
|
||||
@buttons.setter
|
||||
def buttons(self) -> None:
|
||||
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