l3mpire / lemverse

The first-ever coworking metaverse
https://app.lemverse.com
GNU Affero General Public License v3.0
149 stars 43 forks source link

Use event.KeyCode on keyboard to trigger all layout keyboards #191

Closed alimtunc closed 1 year ago

alimtunc commented 1 year ago

Handle other layout keyboards, there is only one thing left. Determine if it's Qwerty or Azerty.. I've tried to use something like this https://stackoverflow.com/a/59113178 or directly using hotkeys.trigger() and determine is keyCode. But none of them worked. Is there any solution to determine the layout of a keyboard actually @Donorhan ?

Donorhan commented 1 year ago

To my knowledge there is no technique to detect the layout of a keyboard. There is Keyboard.getLayoutMap() but it doesn't return anything very interesting and it is experimental. In any case using event.code is the right way to not worry about the QWERTY/AZERTY configuration 👍🏻

alimtunc commented 1 year ago

Yes sure, but the point was for the visual letter on keyboard haha

Flowtter commented 1 year ago

I think you could use keyboard event

Here is an example on an azerty keyboard: image

And a qwerty one image

Donorhan commented 1 year ago

@alimtunc I'm not sure I understand then, you want to display an image according the layout right?

alimtunc commented 1 year ago

@alimtunc I'm not sure I understand then, you want to display an image according the layout right?

I want to display the correct letter on the direction step

ramnes commented 1 year ago

The easy fix could be to only display the arrows and let "advanced" users (i.e. people who played games in their life) realize that WASD / ZQSD also triggers the arrows. :)

alimtunc commented 1 year ago

@Donorhan @ramnes all is good

Donorhan commented 1 year ago

Thanks you!