Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inline calls to key_index into methods which operate on keys #416

Merged
merged 2 commits into from Dec 31, 2020

Conversation

benmkw
Copy link
Contributor

@benmkw benmkw commented Dec 29, 2020

I am not sure if someone needs to call key_index so maybe this should still remain pub but I could not see an obvious reason (and also not specific reason for the casts but don't have a strong opinion about it either).

closes #415

CHANGELOG.markdown Show resolved Hide resolved
imgui/src/input/keyboard.rs Show resolved Hide resolved
@thomcc thomcc merged commit 7fce85f into imgui-rs:master Dec 31, 2020
@norcalli
Copy link

This entire MR is incorrect. For one, the keys_down array is 512 long, whereas the key_map is only 22 long. Forcing the key_conversion index means you can't actually use any of the key_down parts of the code anymore.

@thomcc
Copy link
Member

thomcc commented Feb 14, 2021

I think it's fair to state that this probably inadvertently harmed some use cases (use cases involing keys that imgui doesn't use). You should still be able to access it via io, e.g. ui.io().key_map[N].

That said, it's probably worth adding back functions to call the ImGUI functions without going through the key map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI::is_key_released may be easy to use incorrectly because of u32 key_index
3 participants