bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
35.02k stars 3.43k forks source link

Allow Bevy windows to be spawned as a child of an existing window #13194

Open vveisard opened 4 months ago

vveisard commented 4 months ago

What problem does this solve or what need does it fill?

Currently, a Bevy app is designed to be a standalone application. Instead, I need to use a Bevy app within an existing application.

What solution would you like?

I would like to be able to initialize a Bevy window as a child of an existing window; this seems like the most straightforward and promising way.

Additional context

There was a previous discussion about this here #4838, which forked bevy_winit to create all windows as a child window using https://smithay.github.io/smithay/winit/window/struct.WindowBuilder.html#method.with_parent_window

It's unclear to me if this a parent window should be shared for all windows in the app, or per-window.

It seems winit child windows have poor multi-platform support (not sure if this matters?).

I'd love to implement this myself once I have some guidance on how to proceed.

alice-i-cecile commented 4 months ago

Are there any constraints on what the parent application is written in? Is this in the context of an existing winit-based application, or do you need something more exotic?

vveisard commented 4 months ago

Are there any constraints on what the parent application is written in? Is this in the context of an existing winit-based application, or do you need something more exotic?

Yes, this is in the context of an existing winit application (using https://github.com/tauri-apps/wry).

alice-i-cecile commented 4 months ago

Great, thanks for the clarification. I've swapped the title over to something a bit more clearly scoped :) I think this should be achievable, and I'm fine with adding niche API surface like this as long as the docs are clear.