From 17c947b6fbc5e019c582876745dcdd1051115346 Mon Sep 17 00:00:00 2001 From: Jan Lerking Date: Fri, 25 Apr 2025 18:19:05 +0200 Subject: [PATCH] Updated mappings. /JL --- pygameControls/controller.py | 2 +- pygameControls/dualsense_controller.py | 30 +++++++------------ pygameControls/generic_controller.py | 30 ++++++++----------- .../logitech_dual_action_controller.py | 30 ++++++++----------- pygameControls/logitech_f310_controller.py | 30 +++++++------------ pygameControls/logitech_f510_controller.py | 30 +++++++------------ pygameControls/logitech_f710_controller.py | 30 +++++++------------ pygameControls/xbox_series_x_controller.py | 28 +++++++---------- setup.py | 2 +- 9 files changed, 80 insertions(+), 132 deletions(-) diff --git a/pygameControls/controller.py b/pygameControls/controller.py index c69030b..bd42067 100644 --- a/pygameControls/controller.py +++ b/pygameControls/controller.py @@ -9,7 +9,7 @@ from .xbox_series_x_controller import XboxSeriesXController from .generic_controller import GenericController from .logitech_dual_action_controller import LogitechDualActionController -__version__ = "0.1.10" +__version__ = "0.1.11" CONTROLLERS = { "DualSense Wireless Controller": DualSenseController, diff --git a/pygameControls/dualsense_controller.py b/pygameControls/dualsense_controller.py index 6a92bd3..a9de40d 100644 --- a/pygameControls/dualsense_controller.py +++ b/pygameControls/dualsense_controller.py @@ -25,25 +25,17 @@ class DualSenseController(ControlsBase): self.numbuttons: int = joy.get_numbuttons() self.buttons: list = [joy.get_button(b) for b in range(self.numbuttons)] self.mapping = { - "left stick x": self.axis[0], - "left stick y": self.axis[1], - "right stick x": self.axis[3], - "right stick y": self.axis[4], - "right trigger": self.buttons[5], - "left trigger": self.buttons[2], - "dhat x": self.hats[0][0], - "dhat y": self.hats[0][1], - "left button": self.buttons[4], - "right button": self.buttons[5], - "cross button": self.buttons[0], - "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] + "l1 button": 4, + "r1 button": 5, + "cross button": 0, + "triangle button": 2, + "circle button": 1, + "square button": 3, + "left stick button": 11, + "right stick button": 12, + "connect button": 8, + "list button": 9, + "logo button": 10 } print(f"{self.name} connected") print(f"Power level: {self.powerlevel}") diff --git a/pygameControls/generic_controller.py b/pygameControls/generic_controller.py index b9073ba..ebdfc9e 100644 --- a/pygameControls/generic_controller.py +++ b/pygameControls/generic_controller.py @@ -14,24 +14,18 @@ class GenericController(ControlsBase): self.numbuttons: int = self.device.get_numbuttons() self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)] self.mapping = { - "left stick x": self.axis[0], - "left stick y": self.axis[1], - "right stick x": self.axis[2], - "right stick y": self.axis[3], - "right trigger": self.buttons[7], - "left trigger": self.buttons[6], - "dhat x": self.hats[0][0], - "dhat y": self.hats[0][1], - "left button": self.buttons[4], - "right button": self.buttons[5], - "X button": self.buttons[0], - "Y button": self.buttons[3], - "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], + "r2 trigger": 7, + "l2 trigger": 6, + "l1 button": 4, + "r1 button": 5, + "X button": 0, + "Y button": 3, + "A button": 1, + "B button": 2, + "left stick button": 10, + "right stick button": 11, + "back button": 8, + "start button": 9, "logo button": None } print(f"{self.name} connected.") diff --git a/pygameControls/logitech_dual_action_controller.py b/pygameControls/logitech_dual_action_controller.py index 314ef6a..6ae0c51 100644 --- a/pygameControls/logitech_dual_action_controller.py +++ b/pygameControls/logitech_dual_action_controller.py @@ -35,24 +35,18 @@ class LogitechDualActionController(ControlsBase): self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)] self.input_mode = InputMode.DirectInput self.mapping = { - "left stick x": self.axis[0], - "left stick y": self.axis[1], - "right stick x": self.axis[2], - "right stick y": self.axis[3], - "right trigger": self.buttons[7], - "left trigger": self.buttons[6], - "dhat x": self.hats[0][0], - "dhat y": self.hats[0][1], - "left button": self.buttons[4], - "right button": self.buttons[5], - "X button": self.buttons[0], - "Y button": self.buttons[3], - "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], + "r2 trigger": 7, + "l2 trigger": 6, + "l1 button": 4, + "r1 button": 5, + "X button": 0, + "Y button": 3, + "A button": 1, + "B button": 2, + "left stick button": 10, + "right stick button": 11, + "back button": 8, + "start button": 9, "logo button": None } print(f"{self.name} connected.") diff --git a/pygameControls/logitech_f310_controller.py b/pygameControls/logitech_f310_controller.py index 6e22bab..d22ad97 100644 --- a/pygameControls/logitech_f310_controller.py +++ b/pygameControls/logitech_f310_controller.py @@ -35,25 +35,17 @@ class LogitechF310Controller(ControlsBase): self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)] self.input_mode = InputMode.XInput self.mapping = { - "left stick x": self.axis[0], - "left stick y": self.axis[1], - "right stick x": self.axis[3], - "right stick y": self.axis[4], - "right trigger": self.axis[2], - "left trigger": self.axis[5], - "dhat x": self.hats[0][0], - "dhat y": self.hats[0][1], - "left button": self.buttons[4], - "right button": self.buttons[5], - "X button": self.buttons[2], - "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] + "l1 button": 4, + "r1 button": 5, + "X button": 2, + "Y button": 3, + "A button": 0, + "B button": 1, + "left stick button": 9, + "right stick button": 10, + "back button": 6, + "start button": 7, + "logo button": 8 } print(f"{self.name} connected.") diff --git a/pygameControls/logitech_f510_controller.py b/pygameControls/logitech_f510_controller.py index 5494427..fe26fe2 100644 --- a/pygameControls/logitech_f510_controller.py +++ b/pygameControls/logitech_f510_controller.py @@ -37,25 +37,17 @@ class LogitechF510Controller(ControlsBase): self.buttons: list = [] self.input_mode: InputMode.DirectInput self.mapping = { - "left stick x": self.axis[0], - "left stick y": self.axis[1], - "right stick x": self.axis[3], - "right stick y": self.axis[4], - "right trigger": self.axis[2], - "left trigger": self.axis[5], - "dhat x": self.hats[0][0], - "dhat y": self.hats[0][1], - "left button": self.buttons[4], - "right button": self.buttons[5], - "X button": self.buttons[2], - "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] + "l1 button": 4, + "r1 button": 5, + "X button": 2, + "Y button": 3, + "A button": 0, + "B button": 1, + "left stick button": 9, + "right stick button": 10, + "back button": 6, + "start button": 7, + "logo button": 8 } print(f"{self.name} connected.") diff --git a/pygameControls/logitech_f710_controller.py b/pygameControls/logitech_f710_controller.py index e3c1c5e..8cabfa5 100644 --- a/pygameControls/logitech_f710_controller.py +++ b/pygameControls/logitech_f710_controller.py @@ -37,25 +37,17 @@ class LogitechF710Controller(ControlsBase): self.buttons: list = [] self.input_mode: InputMode.DirectInput self.mapping = { - "left stick x": self.axis[0], - "left stick y": self.axis[1], - "right stick x": self.axis[3], - "right stick y": self.axis[4], - "right trigger": self.axis[2], - "left trigger": self.axis[5], - "dhat x": self.hats[0][0], - "dhat y": self.hats[0][1], - "left button": self.buttons[4], - "right button": self.buttons[5], - "X button": self.buttons[2], - "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] + "l1 button": 4, + "r1 button": 5, + "X button": 2, + "Y button": 3, + "A button": 0, + "B button": 1, + "left stick button": 9, + "right stick button": 10, + "back button": 6, + "start button": 7, + "logo button": 8 } print(f"{self.name} connected.") diff --git a/pygameControls/xbox_series_x_controller.py b/pygameControls/xbox_series_x_controller.py index b2aa230..0a96842 100644 --- a/pygameControls/xbox_series_x_controller.py +++ b/pygameControls/xbox_series_x_controller.py @@ -13,26 +13,18 @@ class XboxSeriesXController(ControlsBase): self.numbuttons: int = self.device.get_numbuttons() self.buttons: list = [self.device.get_button(b) for b in range(self.numbuttons)] self.mapping = { - "left stick x": self.axis[0], - "left stick y": self.axis[1], - "right stick x": self.axis[2], - "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], + "l1 button": 6, + "r1 button": 7, + "X button": 3, "Y button": 4, "A button": 0, - "B button": self.buttons[1], - "left stick button": self.buttons[13], - "right stick button": self.buttons[14], - "logo button": self.buttons[12], - "share button": self.buttons[15], - "list button": self.buttons[11], - "copy button": self.buttons[10] + "B button": 1, + "left stick button": 13, + "right stick button": 14, + "logo button": 12, + "share button": 15, + "list button": 11, + "copy button": 10 } print(f"{self.name} connected.") diff --git a/setup.py b/setup.py index e6ec625..783a4ca 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ if __name__ == "__main__": setup( name='pygameControls', - version='0.1.10', + version='0.1.11', packages=find_packages(), install_requires=[], author='Jan Lerking',