ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
57.96k stars 9.93k forks source link

French Keyboard and Backend SDL2 - Several keys are not checkable with IsKeyDown #7306

Open oschemid opened 4 months ago

oschemid commented 4 months ago

Version/Branch of Dear ImGui:

Version 1.90.2

Back-ends:

imgui_impl_sdl2.cpp

Compiler, OS:

Windows11 + VS2022

Full config/build information:

No response

Details:

Hello,

I uses the function IsKeyDown to check if the user presses a key. With my french keyboard, I cannot check the key called SDLK_Minus on an US Keyboard (the key after the 0), because the library SDL2 maps the key on SDLK_RIGHTPAREN.

I checked with the tools Demo-> Inputs & Focus and I found that several keys are not displayed in "Keys Down": SDL_scancode_minus which is mapped to SDLK_RIGHTPAREN on my keyboard layout SDL_scancode_period mapped to SDLK_COLON SDL_scancode_slash mapped to SDLK_EXCLAIM SDL_scancode_baskslash mapped to SDLK_ASTERISK ...

Do I have a solution, without modifying the function ImGui_ImplSDL2_KeycodeToImGuiKey to fix this issue ?

Regards

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");
MoreCodeToExplainMyIssue();
ImGui::End();
PathogenDavid commented 4 months ago

Semi-related issue with other non-US keyboards: https://github.com/ocornut/imgui/issues/7136

ocornut commented 4 months ago

@oschemid See https://github.com/ocornut/imgui/issues/7201#issuecomment-1939361997 for further work on this.

I don't yet know what is the best solution for this. French appears to be the one with most holes but I presume other European languages would likely be affected, so I'd like to data for some of them.

oschemid commented 4 months ago

Thank you @ocornut I fixed temporarily the function ImGui_ImplSDL2_KeycodeToImGuiKey waiting for best implementation. If I can help you, don't hesitate