-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Allow read-write access to raw WindowEvents within Bevy apps #5977
Comments
This is blocked on rust-windowing/winit#1387, as |
This isn't quite blocked, the |
Just wanted to chime in and give a +1 to this issue. I recently went down the same rabbit hole of wanting to access raw events before the winit runner had the chance to convert them into bevy events and was unable to do so. (in my case because I wanted to pass the raw events to egui-winit so that I could use egui without using the bevy renderer and a crate like bevy_egui, but that's beside the point) I think the interface that would have been most ergonomic for me would be to have been able to pass in an "intercept" function that took in winit window events and done whatever processing I wanted with them and then returned a boolean indicating if that event should be propagated down to the winit-runner or not. |
I would also like to +1 this, especially the read access. My use case is for a custom rendering backend that implements egui support transitively via So in general, Bevy could be even more modular by exposing winit events directly. I don't see any particular problem with this for the following reasons:
|
# Objective - Exposes raw winit events making Bevy even more modular and powerful for custom plugin developers (e.g. a custom render plugin). XRef: #5977 It doesn't quite close the issue as sending events is not supported (or not very useful to be precise). I would think that supporting that requires some extra considerations by someone a bit more familiar with the `bevy_winit` crate. That said, this PR could be a nice step forward. ## Solution Emit `RawWinitWindowEvent` objects for each received event. ## Testing I verified that the events are emitted using a basic test app. I don't think it makes sense to solidify this behavior in one of the examples. --- ## Showcase My example usage for a custom `egui_winit` integration: ```rust for ev in winit_events.read() { if ev.window_id == window.id { let _ = egui_winit.on_window_event(&window, &ev.event); } } ``` --------- Co-authored-by: IceSentry <[email protected]>
# Objective - Exposes raw winit events making Bevy even more modular and powerful for custom plugin developers (e.g. a custom render plugin). XRef: bevyengine#5977 It doesn't quite close the issue as sending events is not supported (or not very useful to be precise). I would think that supporting that requires some extra considerations by someone a bit more familiar with the `bevy_winit` crate. That said, this PR could be a nice step forward. ## Solution Emit `RawWinitWindowEvent` objects for each received event. ## Testing I verified that the events are emitted using a basic test app. I don't think it makes sense to solidify this behavior in one of the examples. --- ## Showcase My example usage for a custom `egui_winit` integration: ```rust for ev in winit_events.read() { if ev.window_id == window.id { let _ = egui_winit.on_window_event(&window, &ev.event); } } ``` --------- Co-authored-by: IceSentry <[email protected]>
What problem does this solve or what need does it fill?
While working on an input capture and playback library, @plof27 pointed out that I may be able to capture raw events from
winit
directly, rather than dealing with the separated event streams.Unfortunately, the necessary
WindowEvent
type is not exposed inwinit_runner_with
, ourwinit
-based app runner.What solution would you like?
winit
loop.These should be exposed as a simple
Events<WindowEvent>
; the complexity comes from ensuring thatwinit_runner_with
responds appropriately.What alternative(s) have you considered?
I've considered exposing this with a custom runner, however #4537 means this is a tedious and duplication-heavy task.
The text was updated successfully, but these errors were encountered: