|
|
|
|
|
by klodolph
1900 days ago
|
|
Normally, keyboards report data to the computer which represents the location of a key on a standard keyboard. The OS translates to characters based on configured layout. The actual letters printed on the key caps are just decorative. If you type WASD on a US layout USB keyboard, the computer will receive key codes 26, 4, 22, 7. If you type ZQSD on a French keyboard you get exactly the same result. So if you are writing a game, you might listen for codes 26, 4, 22, 7 and these will be in the sample place on the keyboard regardless of layout. You can ask the OS to translate these codes to letters for help text. (Some of the details here are omitted—the codes above are USB HID codes, but those go through an additional OS-specific translation table before they are sent to your program.) |
|