Fyrox icon indicating copy to clipboard operation
Fyrox copied to clipboard

Support more KeyCodes

Open Eragonfr opened this issue 4 years ago • 1 comments

Some computers have unsupported keys like é, è or ù And they are directly accessible on the keyboard without any key combination. I only can think of AZERTY and BÉPO with them, but I'm sure that if we search a little bit more we can find many more keyboard layout with other key accessible.

It could be a good idea to change the way the key is handled so you won't need an Enum with every key in the world.

Eragonfr avatar Aug 11 '21 16:08 Eragonfr

rg3d uses winit to handle input, and winit use VirtualKeyCode to define a fixed set of keys on various keyboards. It means that VirtualKeyCode is mapped directly on a physical key on your keyboard. However for some situations it is not enough, and to solve this every OS provides a set of mappings from physical keys to a character set. For example QWERTY is (mostly) 1-to-1 mapping from physical to character set, but AZERTY is a different mapping. To handle this, winit provides a special event called WindowEvent::ReceivedCharacter which has mapped unicode character.

mrDIMAS avatar Aug 11 '21 17:08 mrDIMAS

I added a Scancode enum (see the commit above), it could be used to get the state of a physical key, that does not depend on the keyboard layout of your OS.

mrDIMAS avatar Aug 06 '23 16:08 mrDIMAS