bevy
bevy copied to clipboard
Added keyboard scan input event
Objective
- I wanted to have controls independent from keyboard layout and found that bevy doesn't have a proper implementation for that
Solution
- I created a
ScanCode
enum with two hundreds scan codes and updatedkeyboard_input_system
to include and updateResMut<Input<ScanCode>>
- closes both https://github.com/bevyengine/bevy/issues/2052 and https://github.com/bevyengine/bevy/issues/862
also i added num_enum
dependency for this to work
Is there a need for the enum? Couldn't we just pass around the raw u32
wrapped in a newtype?
Is there a need for the enum?
I don't know, this is the most obvious approach for me
Couldn't we just pass around the raw u32 wrapped in a newtype?
Maybe, but i'm very new to rust, like, i'm two weeks into it for now
Maybe, but i'm very new to rust, like, i'm two weeks into it for now
No worries, glad you're contributing already. It's a great way to learn! 😄
I’d say we could replace the enum with struct ScanCode(u32)
or something like that. It's easier for others to use and reason with imo
Ok, thanks! This way there's no need in adding new dependencies, and code looks so much cleaner!
bors r+
Pull request successfully merged into main.
Build succeeded: