-
Notifications
You must be signed in to change notification settings - Fork 257
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
Why does this crate not use egui-wgpu
and egui-winit
#324
Comments
Hi! Hm, that is an interesting question. I guess, the biggest reason was that these crates weren't around when the first version of But the real reason is that I've just never considered it. Can either of those crates be re-used to implement a Bevy integration? I've always thought of Bevy as a separate backend (from the integration perspective), even though it uses winit and wgpu under the hood, it provides its own high level wrappers. And they seem to be more straightforward to use, considering it's a Bevy integration in the first place: you have input events, you have a render graph, you have systems pushing updates to Egui and then rendering its output - it all sticks together quite naturally. If we use
I also hope to rework the input system in some near future, to improve the whole "world-space UI" story. We can already render Egui to images (which can be used as material textures for meshes), but we can't really interact with world-space UI. Since Bevy 0.15 has integrated Having that said, I'm not opposed to the idea of depending on either of those crates if |
So, I've been using those crates in a custom renderer I've been working on that uses bevy for everything else. I'm pretty confident that we could use For egui-winit, right now it's not ideal because it assumes you have access to the raw winit event stream. This is not currently the case in bevy so what I do in my project is that I listen to all the relevant events and then send fake winit events to the egui-winit integration. This is not ideal because some of those events have internal data that you can't easily construct and I currently use unsafe for that. The PR I linked should expose everything needed though, so once we have that it becomes a lot easier to integrate winit. The benefits on this one are a bit less clear to me because I'm not 100% sure it will work properly with things like world-space UI. I think the first step would be to try to integrate I'll throw up a PR in the next couple of days for |
IMO the input system should remain independent of winit. World space UI is a good example, the inputs aren't always going to come from the window, you often want to control that interface, or inject inputs for testing. |
@IceSentry that would be great, thank you! Just a heads up, I've just pushed a PR with a refactor of |
Like the title says, why is this crate not using the official helper libraries
egui-wgpu
andegui-winit
? I use them in my own renderer project and the integration with egui becomes tiny. I understand that bevy_egui does a bit more things like exposing a way to useHandle<Image>
but it seems like the crate could be a lot simpler if it uses those helper crates.Is the reason simply that these didn't exist when the crate was originally made?
If there's any interest I could consider making a PR to use those crates instead of all the manual integration work but I don't want to do it before knowing if there's a reason why it wasn't already done.
This bevy PR would make the integration with egui-winit even simpler bevyengine/bevy#15884
The text was updated successfully, but these errors were encountered: