What I'm thinking is much simpler than that. I plan on leaving the existing joystick api in pyglet as-is, and implementing the game controller api as an abstraction over that (how it's done in SDL).
I've already hacked up a quick script that converts the pyglet joystick ids to the SDL GUIDs on Linux. I just need to code up the rest of the abstraction for the game controller buttons and sticks.
Ah, it sure would be nice to drop Python 2 support, wouldn't it? I guess having dual compatibility with 2/3 is a good next step in that direction. One day! Python 2 only has a few years left of support after all.
That is also the reason I use future for the compatibility. It makes python 3 code run on python 2, so you are backwards compatible instead of the other way around.
Rob
Ubuntu and arch Linux are shipping with Python 3 as the default and probably others as well. For a least a few years though Python 2 needs to be supported.
--
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 pyglet-users...@googlegroups.com.
To post to this group, send email to pyglet...@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.
Currently I also mostly replace the quotes. Afaik the double quotes are the preferred ones in python.
Rob
I left the set_position method there because it's not possible to pass more than one value for a @position.setter. If added, it will require x,y to be passed as a tuple. That's OK, but set_position has to stay for now anyway so it doesn't break any code.
-Ben
--
You received this message because you are subscribed to a topic in the Google Groups "pyglet-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyglet-users/dpoL2M8-b4E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyglet-users...@googlegroups.com.
Thanks guys.
I've been working on my Game Controller implementation as well, but need some opinions on the best place to add it in. It's probably best to start a new thread for that.
And you thanks for the contribution.
For the place to add it, I am thinking we might need to upgrade the input module to a package. We can then expose the original contents of the input module through __init__.py.
Rob
Thanks Leif, and Rob, for your feedback.
I've been working on my Game Controller implementation as well, but need some opinions on the best place to add it in. It's probably best to start a new thread for that.
--
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 pyglet-users...@googlegroups.com.
And you thanks for the contribution.
For the place to add it, I am thinking we might need to upgrade the input module to a package. We can then expose the original contents of the input module through __init__.py.
Rob
On 29 Oct 2015 4:40 pm, "Benjamin Moran" <benmo...@gmail.com> wrote:
Thanks Leif, and Rob, for your feedback.
I've been working on my Game Controller implementation as well, but need some opinions on the best place to add it in. It's probably best to start a new thread for that.
--
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 pyglet-users+unsubscribe@googlegroups.com.
BTW, I just noticed I was confused. Input is already a package :-S. Never mind ;-)
Op donderdag 29 oktober 2015 19:57:25 UTC+1 schreef Rob:
And you thanks for the contribution.
For the place to add it, I am thinking we might need to upgrade the input module to a package. We can then expose the original contents of the input module through __init__.py.
Rob
On 29 Oct 2015 4:40 pm, "Benjamin Moran" <benmo...@gmail.com> wrote:
Thanks Leif, and Rob, for your feedback.
I've been working on my Game Controller implementation as well, but need some opinions on the best place to add it in. It's probably best to start a new thread for that.
--
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 pyglet-users...@googlegroups.com.
I'll see if I can answer your questions:
The mapping DB is only parsed when gamepads are enumerated. First a guid is created for the device, which is checked if it's in the mapping DB. If it is, that specific mapping dict is used to map the buttons/axis correctly. It's fast - basically instantaneous because it's only doing some dict queries.
To clarify, nothing is loaded from disk by default. The internal mapping dict is pre-defined, and will contain a few dozen mappings by default. A helper function, add_mappings_from_file(), can be used to expand the internal DB from an external text file. This is an option for application developers.
Basically we could just pre-define the entire community list, but the mapping dictionary does get loaded into memory when gamepads are being created. I'll have to check just how big it is.
mapping_list = [{'guid': '050000004c050000c405000000010000', 'name': 'PS4 Controller (Bluetooth)',
'b': ('button', 2), 'leftshoulder': ('button', 4), 'guide': ('button', 12),
'dpdown': ('hat0', 4), 'rightx': ('axis', 2), 'dpup': ('hat0', 1),
'dpright': ('hat0', 2), 'rightshoulder': ('button', 5), 'y': ('button', 3),
'dpleft': ('hat0', 8), 'righty': ('axis', 5), 'rightstick': ('button', 11),
'platform': 'Linux', 'x': ('button', 0), 'lefty': ('axis', 1), 'a': ('button', 1),
'lefttrigger': ('axis', 3), 'leftx': ('axis', 0), 'back': ('button', 8),
'leftstick': ('button', 10), 'start': ('button', 9), 'righttrigger': ('axis', 4)},
{...}, {...}, {...}]