Merge pull request 'Updated mappings. /JL' (#20) from 0.1.11 into main

Reviewed-on: https://gitpot-lerking.servehttp.com/CodingPirates/PyGame-Controller/pulls/20
This commit was merged in pull request #20.
This commit is contained in:
2025-04-25 18:19:44 +02:00
9 changed files with 80 additions and 132 deletions

View File

@@ -9,7 +9,7 @@ from .xbox_series_x_controller import XboxSeriesXController
from .generic_controller import GenericController from .generic_controller import GenericController
from .logitech_dual_action_controller import LogitechDualActionController from .logitech_dual_action_controller import LogitechDualActionController
__version__ = "0.1.10" __version__ = "0.1.11"
CONTROLLERS = { CONTROLLERS = {
"DualSense Wireless Controller": DualSenseController, "DualSense Wireless Controller": DualSenseController,

View File

@@ -25,25 +25,17 @@ class DualSenseController(ControlsBase):
self.numbuttons: int = joy.get_numbuttons() self.numbuttons: int = joy.get_numbuttons()
self.buttons: list = [joy.get_button(b) for b in range(self.numbuttons)] self.buttons: list = [joy.get_button(b) for b in range(self.numbuttons)]
self.mapping = { self.mapping = {
"left stick x": self.axis[0], "l1 button": 4,
"left stick y": self.axis[1], "r1 button": 5,
"right stick x": self.axis[3], "cross button": 0,
"right stick y": self.axis[4], "triangle button": 2,
"right trigger": self.buttons[5], "circle button": 1,
"left trigger": self.buttons[2], "square button": 3,
"dhat x": self.hats[0][0], "left stick button": 11,
"dhat y": self.hats[0][1], "right stick button": 12,
"left button": self.buttons[4], "connect button": 8,
"right button": self.buttons[5], "list button": 9,
"cross button": self.buttons[0], "logo button": 10
"triangle button": self.buttons[2],
"circle button": self.buttons[1],
"square button": self.buttons[3],
"left stick button": self.buttons[11],
"right stick button": self.buttons[12],
"connect button": self.buttons[8],
"list button": self.buttons[9],
"logo button": self.buttons[10]
} }
print(f"{self.name} connected") print(f"{self.name} connected")
print(f"Power level: {self.powerlevel}") print(f"Power level: {self.powerlevel}")

View File

@@ -14,24 +14,18 @@ class GenericController(ControlsBase):
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.mapping = { self.mapping = {
"left stick x": self.axis[0], "r2 trigger": 7,
"left stick y": self.axis[1], "l2 trigger": 6,
"right stick x": self.axis[2], "l1 button": 4,
"right stick y": self.axis[3], "r1 button": 5,
"right trigger": self.buttons[7], "X button": 0,
"left trigger": self.buttons[6], "Y button": 3,
"dhat x": self.hats[0][0], "A button": 1,
"dhat y": self.hats[0][1], "B button": 2,
"left button": self.buttons[4], "left stick button": 10,
"right button": self.buttons[5], "right stick button": 11,
"X button": self.buttons[0], "back button": 8,
"Y button": self.buttons[3], "start button": 9,
"A button": self.buttons[1],
"B button": self.buttons[2],
"left stick button": self.buttons[10],
"right stick button": self.buttons[11],
"back button": self.buttons[8],
"start button": self.buttons[9],
"logo button": None "logo button": None
} }
print(f"{self.name} connected.") print(f"{self.name} connected.")

View File

@@ -35,24 +35,18 @@ class LogitechDualActionController(ControlsBase):
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.input_mode = InputMode.DirectInput
self.mapping = { self.mapping = {
"left stick x": self.axis[0], "r2 trigger": 7,
"left stick y": self.axis[1], "l2 trigger": 6,
"right stick x": self.axis[2], "l1 button": 4,
"right stick y": self.axis[3], "r1 button": 5,
"right trigger": self.buttons[7], "X button": 0,
"left trigger": self.buttons[6], "Y button": 3,
"dhat x": self.hats[0][0], "A button": 1,
"dhat y": self.hats[0][1], "B button": 2,
"left button": self.buttons[4], "left stick button": 10,
"right button": self.buttons[5], "right stick button": 11,
"X button": self.buttons[0], "back button": 8,
"Y button": self.buttons[3], "start button": 9,
"A button": self.buttons[1],
"B button": self.buttons[2],
"left stick button": self.buttons[10],
"right stick button": self.buttons[11],
"back button": self.buttons[8],
"start button": self.buttons[9],
"logo button": None "logo button": None
} }
print(f"{self.name} connected.") print(f"{self.name} connected.")

View File

@@ -35,25 +35,17 @@ class LogitechF310Controller(ControlsBase):
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.XInput self.input_mode = InputMode.XInput
self.mapping = { self.mapping = {
"left stick x": self.axis[0], "l1 button": 4,
"left stick y": self.axis[1], "r1 button": 5,
"right stick x": self.axis[3], "X button": 2,
"right stick y": self.axis[4], "Y button": 3,
"right trigger": self.axis[2], "A button": 0,
"left trigger": self.axis[5], "B button": 1,
"dhat x": self.hats[0][0], "left stick button": 9,
"dhat y": self.hats[0][1], "right stick button": 10,
"left button": self.buttons[4], "back button": 6,
"right button": self.buttons[5], "start button": 7,
"X button": self.buttons[2], "logo button": 8
"Y button": self.buttons[3],
"A button": self.buttons[0],
"B button": self.buttons[1],
"left stick button": self.buttons[9],
"right stick button": self.buttons[10],
"back button": self.buttons[6],
"start button": self.buttons[7],
"logo button": self.buttons[8]
} }
print(f"{self.name} connected.") print(f"{self.name} connected.")

View File

@@ -37,25 +37,17 @@ class LogitechF510Controller(ControlsBase):
self.buttons: list = [] self.buttons: list = []
self.input_mode: InputMode.DirectInput self.input_mode: InputMode.DirectInput
self.mapping = { self.mapping = {
"left stick x": self.axis[0], "l1 button": 4,
"left stick y": self.axis[1], "r1 button": 5,
"right stick x": self.axis[3], "X button": 2,
"right stick y": self.axis[4], "Y button": 3,
"right trigger": self.axis[2], "A button": 0,
"left trigger": self.axis[5], "B button": 1,
"dhat x": self.hats[0][0], "left stick button": 9,
"dhat y": self.hats[0][1], "right stick button": 10,
"left button": self.buttons[4], "back button": 6,
"right button": self.buttons[5], "start button": 7,
"X button": self.buttons[2], "logo button": 8
"Y button": self.buttons[3],
"A button": self.buttons[0],
"B button": self.buttons[1],
"left stick button": self.buttons[9],
"right stick button": self.buttons[10],
"back button": self.buttons[6],
"start button": self.buttons[7],
"logo button": self.buttons[8]
} }
print(f"{self.name} connected.") print(f"{self.name} connected.")

View File

@@ -37,25 +37,17 @@ class LogitechF710Controller(ControlsBase):
self.buttons: list = [] self.buttons: list = []
self.input_mode: InputMode.DirectInput self.input_mode: InputMode.DirectInput
self.mapping = { self.mapping = {
"left stick x": self.axis[0], "l1 button": 4,
"left stick y": self.axis[1], "r1 button": 5,
"right stick x": self.axis[3], "X button": 2,
"right stick y": self.axis[4], "Y button": 3,
"right trigger": self.axis[2], "A button": 0,
"left trigger": self.axis[5], "B button": 1,
"dhat x": self.hats[0][0], "left stick button": 9,
"dhat y": self.hats[0][1], "right stick button": 10,
"left button": self.buttons[4], "back button": 6,
"right button": self.buttons[5], "start button": 7,
"X button": self.buttons[2], "logo button": 8
"Y button": self.buttons[3],
"A button": self.buttons[0],
"B button": self.buttons[1],
"left stick button": self.buttons[9],
"right stick button": self.buttons[10],
"back button": self.buttons[6],
"start button": self.buttons[7],
"logo button": self.buttons[8]
} }
print(f"{self.name} connected.") print(f"{self.name} connected.")

View File

@@ -13,26 +13,18 @@ class XboxSeriesXController(ControlsBase):
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.mapping = { self.mapping = {
"left stick x": self.axis[0], "l1 button": 6,
"left stick y": self.axis[1], "r1 button": 7,
"right stick x": self.axis[2], "X button": 3,
"right stick y": self.axis[3],
"right trigger": self.axis[4],
"left trigger": self.axis[5],
"dhat x": self.hats[0][0],
"dhat y": self.hats[0][1],
"left button": self.buttons[6],
"right button": self.buttons[7],
"X button": self.buttons[3],
"Y button": 4, "Y button": 4,
"A button": 0, "A button": 0,
"B button": self.buttons[1], "B button": 1,
"left stick button": self.buttons[13], "left stick button": 13,
"right stick button": self.buttons[14], "right stick button": 14,
"logo button": self.buttons[12], "logo button": 12,
"share button": self.buttons[15], "share button": 15,
"list button": self.buttons[11], "list button": 11,
"copy button": self.buttons[10] "copy button": 10
} }
print(f"{self.name} connected.") print(f"{self.name} connected.")

View File

@@ -3,7 +3,7 @@ if __name__ == "__main__":
setup( setup(
name='pygameControls', name='pygameControls',
version='0.1.10', version='0.1.11',
packages=find_packages(), packages=find_packages(),
install_requires=[], install_requires=[],
author='Jan Lerking', author='Jan Lerking',