My project has a hotkey system which in the past used a mix of SDL keycodes and scancodes. Dear ImGui now handles keys through ImGuiKey enum, which maps to SDL2 keycodes. In order to maintain ability to use scancodes for keybindings i need a way to translate SDL2 scancode to ImGuiKey. This can be done indirectly, by translating SDL2 scancode to SDL2 keycode, and then translating SDL2 keycode to ImGuiKey. ImGui_ImplSDL2_KeyEventToImGuiKey function does exactly this, however this function is private and static. For time being i patched SDL2 backend so it exposes this function and i can use it. It would probably be helpful to more people than me alone if there was an official way to translate between ImGuiKey and backend keycode.
Version/Branch of Dear ImGui:
Version 1.91, Branch: docking
Back-ends:
imgui_impl_sdl2.cpp
Compiler, OS:
Not applicalbe
Full config/build information:
No response
Details:
My project has a hotkey system which in the past used a mix of SDL keycodes and scancodes. Dear ImGui now handles keys through
ImGuiKey
enum, which maps to SDL2 keycodes. In order to maintain ability to use scancodes for keybindings i need a way to translate SDL2 scancode toImGuiKey
. This can be done indirectly, by translating SDL2 scancode to SDL2 keycode, and then translating SDL2 keycode toImGuiKey
.ImGui_ImplSDL2_KeyEventToImGuiKey
function does exactly this, however this function is private and static. For time being i patched SDL2 backend so it exposes this function and i can use it. It would probably be helpful to more people than me alone if there was an official way to translate betweenImGuiKey
and backend keycode.Thanks for considering this 🙏
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response