Crate bevy_window_as_ui_root

Crate bevy_window_as_ui_root 

Source
Expand description

Easily spawn windows as independent UI roots. Ideal for debug widgets!

§Usage

app.add_plugins(WindowAsUiRootPlugin);

commands.spawn((
  WindowAsUiRoot,
  BackgroundColor(Color::WHITE),
  children![(
    Text::new("Hello World!"),
    TextColor(Color::BLACK),
  )],
));

Insert the WindowAsUiRoot component on an entity and this plugin will:

  • Insert Node, Window, and Camera components if they don’t already exist.
  • Connect the camera to the root node and window.
  • Automatically resize the window to match the root node’s layout size (if it is auto or fixed).

§Tips

  • Use the CloseWith relation to automatically close nested windows.
  • Set WindowPlugin.exit_condition to ExitCondition::OnPrimaryClosed to prevent popups from outliving the main window.
  • Insert Node { width: percent(100), height: percent(100), ..default() } on the UI root to make it resizable by the user.

Structs§

CloseWith
Add this relation from sub-windows to their parents to automatically close them.
WindowAsUiRoot
Use this component to spawn windows as independent UI roots.
WindowAsUiRootPlugin
This plugin handles creating and resizing windows, add it to use this library.