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

bevy_winit(emit raw winit events) #15884

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

HugoPeters1024
Copy link
Contributor

@HugoPeters1024 HugoPeters1024 commented Oct 13, 2024

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:

for ev in winit_events.read() {
    if ev.0.window_id == window.id {
    let _ = egui_winit.on_window_event(&window, &ev.0.event);
    }
}

Migration Guide

No breaking changes.

@alice-i-cecile alice-i-cecile added this to the 0.16 milestone Oct 13, 2024
@alice-i-cecile alice-i-cecile added A-Windowing Platform-agnostic interface layer to run your app in C-Usability A targeted quality-of-life change that makes Bevy easier to use X-Contentious There are nontrivial implications that should be thought through D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Oct 13, 2024
@HugoPeters1024 HugoPeters1024 force-pushed the hp/raw-winit-events branch 2 times, most recently from dbea568 to 36bac2f Compare October 13, 2024 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Windowing Platform-agnostic interface layer to run your app in C-Usability A targeted quality-of-life change that makes Bevy easier to use D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward X-Contentious There are nontrivial implications that should be thought through
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants