3 ms·
I'm not sure if it's possible to access the character given the key code (the docs you linked implies it's not), but when we're interested in physical keys, I'd
by htgb 9y ago
I'm not sure if it's possible to access the character given the key code (the docs you linked implies it's not), but when we're interested in physical keys, I'd much rather use that nonetheless.
A good way to illustrate the controls could maybe be with an image? The keys on the image could say WASD for all I care, as long as I'm able to see the position of them, which is what matters.
There are similar issues for other things than games. Quite a few programs have `Ctrl + /` or similar as a keyboard shortcut, which is easy on an american keyboard, but on a Swedish one there's no dedicated key for slash (it's `Shift + 7`). The same goes for most symbols except A-Z (I use Swedish QWERTY), they are in other locations and with other modifiers.
Best, of course, is when you can get the character based on the physical key. One example of this is Visual Studio Code, where the shortcut for toggling the console is `Ctrl + Ö`, and presented as such. I assume they defined the shortcut by the physical key (the one to the right of `L` in this case) and presented it by its character.
- mrec 9y agoYeah, in a native app you'd use something like MapVirtualKey [1], but I don't think there's a web equivalent yet. You still see native apps getting this wrong, though. On a UK keyboard Sublime Text's view menu says that "Show Console" is Ctrl-` (backtick), but the key that actually shows the console is Ctrl-' (single quote). Took me a while to find that. [1] https://msdn.microsoft.com/en-us/library/windows/desktop/ms646306(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/ms6...
- KwanEsq 9y agoHuh, I'm using SublimeText with a UK keyboard and Ctrl+` shows the console (Ctrl+' just types a ') That's on Linux though, what are you on, Windows? SublimeText Version 3.0, Build 3143
- mrec 9y agoYeah, Windows 3126. May have been fixed, but definitely not just me: see https://forum.sublimetext.com/search?q=console%20uk https://forum.sublimetext.com/search?q=console%20uk