Skip to content

Conversation

@AnthonyBriggs
Copy link

(I included some extraneous extra stuff with the last pull request -- this is a shiny new one)

This is an updated version of the 'hack' that I posted last week. A rough outline of what I've done:

  • Added handler functions for all of the pygame joystick functions in game.py. I had to put in a hack for the button parameter mapper though, since the two types of buttons conflict. I also added a print statement to the ValueError handler, since the silent error eating caused me a bit of head scratching.
  • Added constants for joystick buttons and axes into constants.py
  • Added pygame.joystick.init() etc. to the runner, and imported a list of joysticks and the relevant constants in builtins
  • Added a simple test for the joystick button handler. Not 100% sure whether you want more tests, eg. of the joystick movement, or if you think this is overkill?
  • Updated the hooks.rst and builtins.rst docs, including examples :)

Let me know what you think - happy to make changes if you need them.

@lordmauve lordmauve added the controller Relates to controller/joystick support label Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

controller Relates to controller/joystick support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants