pgzero icon indicating copy to clipboard operation
pgzero copied to clipboard

Added joystick support.

Open AnthonyBriggs opened this issue 6 years ago • 0 comments

(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.

AnthonyBriggs avatar Sep 13 '18 04:09 AnthonyBriggs