SDL2 has a mapping text file built in these days to do this. You could have a look, but remember that SDL2 is LGPL, but you could ask the developers if you could use it under the BSD license. My Tesun joypad doesn't work properly with the linux kernel I have it appears, so some my axis are conflated so I won't send output.
On Tuesday, 17 November 2015 03:58:21 UTC, Benjamin Moran wrote: > > Hi guys, > > I'm hard at work on my SDL2-style GameController implementation for > pyglet. If you're not familar with this, it's basically a way to > automatically map all common game controllers to a standard internal > layout. This means that your users controllers will just work as expected, > out of the box. > > Part of this implementation requires figuring out a unique ID for each > pyglet joystick, and checking it against a mapping database. On Linux, this > GUID comes from the devices bustype/product/vendor/version IDs. On Windows, > it comes from the DirectInput guidProduct string. That's where I need help. > > If anyone has a joystick/controller (that is not an Xbox 360 controller), > it would help me greatly if you could substitute the function below in the > pyglet\input\directinput.py file. (It's the same function, except with a > print statement that prints out the device GUID details). After > substituting the function, open up a Python interpreter and simply do: > >>> import pyglet > >>> pyglet.input.get_devices() > > Then, copy and paste the output you receive. This will allow me to confirm > that my code is working, and I can release an actual test shortly. The > Linux implementation is already working. I'll need OSX users to help out in > the near future, but not quite yet. > > Thanks in advance! > > def get_devices(display=None): > _init_directinput() > _devices = [] > > def _device_enum(device_instance, arg): > device = dinput.IDirectInputDevice8() > _i_dinput.CreateDevice(device_instance.contents.guidInstance, > ctypes.byref(device), None) > _devices.append(DirectInputDevice(display, device, > device_instance.contents)) > print(device_instance.contents.tszProductName, > device_instance.contents.guidProduct) > return dinput.DIENUM_CONTINUE > > _i_dinput.EnumDevices(dinput.DI8DEVCLASS_ALL, > dinput.LPDIENUMDEVICESCALLBACK(_device_enum), > None, dinput.DIEDFL_ATTACHEDONLY) > return _devices > > > > -- 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 http://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
