I've recently encountered a few headaches when I tried to detect key presses for a custom game engine to supports Windows, MacOS, Linux, and WebGL.
At first I naively thought that using GLFW's
keycodes instead of
scancodes will be the best solution to cover as many operating systems as possible. I later found out that if the player has a different keyboard layout, the keys will be bound all over the place instead of having the WASD keys (regardless of what character they represent) sit together.
So then I moved over to using scancodes. So this works great (other than having a different set of scancodes for each operating system) but it also introduces my first issue. Since