Changing the way the keyboard coding


Is it possible to change the keyboard coding in GLFW?
If so, how can it be done?

Kind regards,

Hi @Rafal,

I don’t understand the question, could you explain what you want to achieve?



I’m using a different set of codes in apps my keyboard keys.
Apart from that, I use a lot of useful functions, e.t.c.

I believe that the user should decide for himself how to code.

Ah, I think I understand what you want to do now - you want to be able to translate between the GLFW Keyboard Keys and another set of key defines.

The standard approach to this is to use a key translation table, for example here is one from Dear ImGui:

Note that this ‘map’ is simply an array of size GLFW_KEY_LAST, so it is fast and simple to use.

You may need two such maps, one to go from GLFW to your app, and another to go in the reverse direction. GLFW itself does not implement this for you because it is intended to be a minimal API, and things which can be done by the user without modifying GLFW should be left to API user code.


Okay, I also use this translation
Why was the standard not used? this is a casual discussion.
I am used to the C language standard, ESC I know it’s 27.


There is no current standard for key input, but the GLFW key codes are inspired by the USB HID Usage Tables v1.12 (p. 53-60), but re-arranged to map to 7-bit ASCII for printable keys (function keys are put in the 256+ range).

There are various standards for string character representation (text), and GLFW uses 32bit Unicode for Text input. Only ‘printable’ characters are sent to the text input callback, so ESC is only available through the key input as it is not printable.