Open martin-t opened 3 years ago
macroquad's keycodes do not depend on layout (just tried switching between languages, KeyCode::W still works)
Which layouts are you trying? When i switch between English and Czech, then pressing the same physical key produces either Y or Z. Also, i am using get_last_key_pressed()
and the number row which contains +ěščřžýáíé returns None
, same for they keys around Enter, which contain "ú)ů§¨".
I tried this:
setxkbmap -model pc104 -layout cz,us -variant ,dvorak -option grp:alt_shift_toggle
than all the keys went crazy, but KeyCode::W
still worked
Also just from the code - we do receive KeyCode's not characters, so I am not really sure how to reproduce/fix this
Hmm, this is weird. When i run your command and then toggle layouts using alt+shift, nothing changes in MQ - each physical key returns the same KeyCode
. However, when i toggle layouts by running the setxkbmap
command, the keycodes change.
E.g. if you run setxkbmap -model pc104 -layout us
, then the number row gives stuff like Some(KeyCode::Key1)
, if you then run setxkbmap -model pc104 -layout cz
, it returns None
. The same thing happens when toggling layouts using KDE.
The current set of input related functions all respect the current layout. This means
KeyCode
enum)As a result, it's impossible to have sane default keybindins that will work for all players. I think Macroquad should expose an alternative way to enumarate keys which would only depend on their physical location, not the player's layout.