Closed shanecelis closed 3 months ago
I tried to do a little better about repeated keys when kitty isn't present. Now it will check if a key is pressed again when kitty isn't present before sending a release event. I'm pretty happy with that.
Wow, this is great! I've been hoping to add something like this because I'd like bevy_ratatui_render to be something that can be dropped into any bevy project as-is without needing to handle TTY idiosyncrasies. I'll try to give a review some time this evening.
Attention: Patch coverage is 0%
with 633 lines
in your changes missing coverage. Please review.
Project coverage is 0.00%. Comparing base (
9d26164
) to head (e7410a5
).
Files | Patch % | Lines |
---|---|---|
src/input_forwarding/keyboard.rs | 0.00% | 611 Missing :warning: |
src/event.rs | 0.00% | 18 Missing :warning: |
src/ratatui.rs | 0.00% | 4 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
All right. Have a look at it now.
I was working on bevy_crossterm adding passing keys from it to bevy's input system, and someone pointed out your crate. Well, I took my changes there and adapted them here, and they were easy to integrate. This is a nice crate! This feature will work with and without kitty. Without kitty it merely sends a released key event on the next frame, which is fine for a pressed key but when a key is held down I'm not sure it's the best we can do.
I only added two public items
bevy_compat::KeyboardPlugin
and anevent::InputSet
. TheInputSet
is to ensure that crossterm sends out its events, then this plugin can read them and send out bevy's events.I did add this plugin to the default plugins. It doesn't seem to interfere with any of the examples. It hopefully merely lets the users choose to use which input is most convenient for them.
I covered many of the keys, but they are definitely some gaps. Gaps will result in no bevy event being emitted. I did not attempt to discriminate between numpad keys.
I added a
bevy_keys
example copied from thekitty
example initially.If this is accepted, I imagine a
bevy_compat::MousePlugin
will come in the future.