Hi Guys, Here is a rough implementation of an SDL2 stype Game Controller API in pyglet. https://drive.google.com/file/d/0B2qKznyXlpVYeF80Y0VLRTctdmM/view?usp=sharing (Just unzip, and run controllertest.py)
This is a rough first implementation that works completely alongside the existing Joystick classes, and is largely modeled after it. I did it this way to avoid any unnecessary overhead of layering this on top of the existing Joystick devices, and also because it was a learning experience for me. I'm not sure yet if I want to finish this up as it is, or reimplement this another way. I'd appreciate feedback on that. !! Windows and OSX are not yet complete. Windows mostly works but HAT handling is not yet written. Needs a few hours to complete. !! What's new: 1. pyglet.input.gamecontroller.py is new. This contains code for parsing the SDL2 style mappings, as well as code to create SDL2 style joystick GUIDs. What's added: 1. pyglet.input.base contains a new GameController class. Similar to the Joystick class, but is automapped to the consistent layout for buttons/axis. 2. pyglet.input.evdev contains a new get_game_controllers function. 3. pyglet.input.directinput also contains a new get_game_controllers function (not yet working due to missing code in base). I wanted to finish up the Windows bits before throwing this out there, but I've been short on time recently. I figured I should get some feedback on the design first, before spending any more time on it. Thanks! -Ben -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
