Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Controller Support #7

Open
Dev5H0 opened this issue Nov 20, 2021 · 1 comment
Open

Add Controller Support #7

Dev5H0 opened this issue Nov 20, 2021 · 1 comment

Comments

@Dev5H0
Copy link

Dev5H0 commented Nov 20, 2021

  • Nintendo Switch Pro Controller
  • PS5 Controller ("DualSense")
@ploiu
Copy link

ploiu commented Aug 18, 2024

I'm not familiar enough with this library to want to make a pull request (and I know this thread is old), but this works for me

class SwitchPro(Gamepad.Gamepad):
    fullName = "Nintendo Switch Pro Controller"

    def __init__(self, joystickNumber=0):
        Gamepad.Gamepad.__init__(self, joystickNumber)
        self.axisNames = {
            # Joysticks
            1: "LSV",  # Left Stick Vertical
            0: "LSH",  # eft Stick Horizontal
            3: "RSV",  # Right Stick Vertical
            2: "RSH",  # Right Stick Horizontal
            # D pad
            5: "DV",  # D-Pad Vertical
            4: "DH",  # D-Pad Horizontal
        }

        self.buttonNames = {
            # faces
            0: "B",
            1: "A",
            2: "X",
            3: "Y",
            # menuing
            10: "Plus",
            9: "Minus",
            # joysticks
            12: "Left Stick Button",
            13: "Right Stick Button",
            # special
            11: "Home",
            4: "Screenshot",
            # bumpers / triggers
            5: "LB",
            6: "RB",
            7: "LT",
            8: "RT",
        }

        self._setupReverseMaps()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants