I just took a look as well, and the key mappings do indeed look to be hardcoded to the scancodes.
On Friday, October 14, 2016 at 7:01:27 AM UTC+9, swiftcoder wrote: > > I'm actually not sure why this is occurring in the first place. > > I just poked through pyglet's Cocoa implementation, and it is using > scancodes directly. > > Are we sure they are getting remapped on an AZERTY keyboard? > On Thu, Oct 13, 2016 at 12:34 PM, Daniel Gillet <[email protected] > <javascript:>> wrote: > >> Thanks everyone for your inputs. >> >> Thinking more about it, I believe that scancodes are not the way to go. >> Even if I want to have the game offer the WASD keys as a starting point, >> and let's say it would be possible to use scancodes, then what happens when >> we offer the player to configure the keys themselves. We will probably end >> up with a mix of scancodes and *normal* keys. >> >> A better way in my opinion would be to have some additional function in >> pyglet which allow a program to know what is the actual key constant, given >> a key constant on a defined keyboard layout. Something roughly similar to >> >> my_key = get_key_from_keyboard(key.A, "US") >> >> This would for instance return the constant key.A on a US keyboard, but >> would return the key constant key.Q on a french keyboard. And when I say >> keyboard, I mean virtual keyboard, ie. whatever the user chose to map its >> keyboard to. >> >> Dan >> >> Le lundi 10 octobre 2016 17:01:06 UTC+2, Daniel Gillet a écrit : >>> >>> Hello, >>> >>> For a game, I want to allow the player to move with the keys WASD. But >>> this is on a QWERTY keyboard. If someone had an AZERTY keyboard, it would >>> be the keys ZQSD. In pygame and tkinter, it's possible to use the actual >>> key scancode to uniquely identify a key on the keyboard, no matter what >>> letter is attached to it. Do you think this would be possible in pyglet? >>> >>> I've looked a bit in the code, and it seems like this is not going to be >>> possible, as pyglet already translate it to a virtual keyboard. But I >>> thought I would ask, in case someone had a solution. >>> >>> Dan. >>> >> -- >> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at https://groups.google.com/group/pyglet-users. >> For more options, visit https://groups.google.com/d/optout. >> > -- 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.
