Page 1 of 1

Read keyboard layout from system

Posted: Sat May 20, 2017 5:52 pm
by cogwheel
There are APIs to translate scan codes between QWERTY and whatever the system layout is set to. This means you can keep the physical layout of keybindings the same and just display a different name to the user. E.g. https://wiki.libsdl.org/CategoryKeyboard

Non-QWERTY users would never have to change their key bindings to match their layout, layouts would no longer break when switching between systems. These issues are particularly annoying with a lot of mods.

Re: Read keyboard layout from system

Posted: Thu May 25, 2017 9:28 pm
by ssilk
This is quite interesting, but I fear, this is not possible, cause they use Allegro for that.
https://www.allegro.cc/manual/5/keyboard.html

Re: Read keyboard layout from system

Posted: Sun May 28, 2017 8:11 pm
by cogwheel
I could be wrong, but it seems they could use this SDL lib just for translating the scan codes even if they don't use it for the actual input handling. The scan codes come from the hardware so they'll be the same in either case.

Alternatively, since SDL is under zlib license, they can copy whatever bits would help get the job done ;)

Re: Read keyboard layout from system

Posted: Mon May 29, 2017 1:39 pm
by leoch
I'm sure its possible one way or another.

Personally, I gave up translating the keyboard bindings to be usable on my keyboard, and just created a Factorio mapping for my G13 using the existing Factorio bindings. But if you don't have a dedicated gaming keyboard and don't like QWERTY, this doesn't help you much.

Re: Read keyboard layout from system

Posted: Wed Feb 21, 2018 7:36 pm
by cogwheel

Re: Read keyboard layout from system

Posted: Sun Mar 31, 2019 8:39 pm
by posila
Switched to SDL and scancodes in 0.17 https://www.factorio.com/blog/post/fff-259