A wrapper for Pygame's joystick module
Author: Cameron Rosenthal @Supernova1114
Pygame: https://github.com/pygame/pygame
Tested with Python 3.10, Pygame 2.1.2, on Ubuntu 22.04 Desktop & Server
Controllers tested: XBox One S, PS4, PS5
Note: To use on python versions lower than 3.10, switch the match-case statements to if-else branches.
pip3 install pygame
- Controller hot-plug support.
- Support for matching button and axis layouts across different controllers.
- Function callbacks for button presses (Async), in addition to button value reading.
- Easy access to grouped joystick axis data. (Ex: (x,y) for Left Stick).
- Axis deadzones.
- Muliple-controller support.
- Example use of API is shown in api_example.py
- Pygame's gamepad tester is controller_test.py
- Use controller_test.py or an online gamepad tester to see button and axis ID's, and controller name.
- Open gamepads.config and assign correct ID's to each button / axis.
- Make sure controller name is correct.