napframework / nap

NAP Framework source code
https://nap-framework.tech
Mozilla Public License 2.0
410 stars 23 forks source link

Enter/Return key ImGui remap #14

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hey, https://github.com/napframework/nap/blob/04801e6d49d2476a88abb2907d091675eca01b7c/modules/napimgui/src/imguiservice.cpp#L389 Isn't this supposed to be

io.KeyMap[ImGuiKey_Enter] = (int)EKeyCode::KEY_RETURN;

?

cklosters commented 1 year ago

Hi, I think you're correct. According to SDL:

"Return" (the Enter key (main keyboard))

Since ImGui doesn't distinguish between the return and enter key, the default enter should be the return key. Lovely bit of awkward cs heritage.

Feel free to submit a PR, otherwise I'll update it for the next release.

ghost commented 1 year ago

Being able to finalize input fields by pressing enter is the main victory with this fix. Another issue in close relation to this is being able to delay committing the value until focus is lost. But let's now forget about that as it might just be improper flag usage in our application.

cklosters commented 1 year ago

Merged: https://github.com/napframework/nap/pull/15

Please open another issue if the problem you mentioned is related to our implementation of ImGUI.