Updated. /JL
This commit is contained in:
50
pygameController/generic_controller.py
Normal file
50
pygameController/generic_controller.py
Normal file
@@ -0,0 +1,50 @@
|
||||
import pygame
|
||||
from pygameController.controlsbase import ControlsBase
|
||||
|
||||
class GenericController(ControlsBase):
|
||||
def __init__(self, joy):
|
||||
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.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()
|
||||
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)]
|
||||
print(f"{self.name} connected")
|
||||
print("GUID:", self.guid)
|
||||
print("Axis:", self.numaxis, self.axis)
|
||||
print("Hats:", self.numhats, self.hats)
|
||||
print("Buttons:", self.numbuttons, self.buttons)
|
||||
|
||||
def handle_input(self, event):
|
||||
pass
|
||||
|
||||
def left(self):
|
||||
pass
|
||||
|
||||
def right(self):
|
||||
pass
|
||||
|
||||
def up(self):
|
||||
pass
|
||||
|
||||
def down(self):
|
||||
pass
|
||||
|
||||
def pause(self):
|
||||
pass
|
||||
|
||||
def rumble(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self._name
|
||||
|
||||
@name.setter
|
||||
def name(self, name: str) -> None:
|
||||
self._name = name
|
||||
|
Reference in New Issue
Block a user