Changing the way the keyboard coding

Hi,

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

Kind regards,
Rafał

Hi @Rafal,

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

Cheers,

Doug.

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.

Cheers,
Doug.

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.