I'm trying to create a second window using druid. I have a button that's supposed to create a secondary window:
let enter_btn = Button::new("Enter")
.on_click(|_ctx, data: &mut HelloState, _env| {
AppLauncher::with_window(game_window)
.use_simple_logger()
.launch((*data).game_state)
.expect("Failed to launch application");
});
However, I see that this is not possible since I am using AppLauncher
to do this. I tried searching through the documentation to no avail since most of the structs with the name Window
just pertains to the Window descriptions and ID and I can't find anything about creating new windows. Is this possible using Druid? If so, what's the best way to open a new window while sharing the same state?
You can use
EventCtx::new_window
for this.druid
also has an example for this use case, the relevant part is this: