Expand description
This crate provides an Egui integration for the Bevy game engine.
Trying out:
An example WASM project is live at mvlabat.github.io/bevy_egui_web_showcase [source].
Features:
- Desktop and web platforms support
- Clipboard (web support is limited to the same window, see rust-windowing/winit#1829)
- Opening URLs
- Multiple windows support (see ./examples/two_windows.rs)
bevy_egui
can be compiled with using only bevy
and egui
as dependencies: manage_clipboard
and open_url
features,
that require additional crates, can be disabled.
Usage
Here’s a minimal usage example:
use bevy::prelude::*;
use bevy_egui::{egui, EguiContexts, EguiPlugin};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(EguiPlugin)
// Systems that create Egui widgets should be run during the `CoreSet::Update` set,
// or after the `EguiSet::BeginFrame` system (which belongs to the `CoreSet::PreUpdate` set).
.add_systems(Update, ui_example_system)
.run();
}
fn ui_example_system(mut contexts: EguiContexts) {
egui::Window::new("Hello").show(contexts.ctx_mut(), |ui| {
ui.label("world");
});
}
For a more advanced example, see examples/ui.rs.
cargo run --example ui
See also
Re-exports
pub use egui;
Modules
- Egui render node.
- The names of
bevy_egui
nodes. - Plugin systems for the render app.
- Plugin systems.
Structs
- A resource for accessing clipboard.
- A component for storing
bevy_egui
context. - Queries all the Egui related components.
- Automatically generated [
WorldQuery
] item type forEguiContextQuery
, returned when iterating over query results. - Automatically generated [
WorldQuery
] type for a read-only variant ofEguiContextQuery
. - Automatically generated [
WorldQuery
] item type forEguiContextQueryReadOnly
, returned when iterating over query results. - A helper SystemParam that provides a way to get
[EguiContext]
with less boilerplate and combines a proxy interface to theEguiUserTextures
resource. - Is used for storing Egui context input..
- Represents a texture allocated and painted by Egui.
- Contains textures allocated and painted by Egui.
- A resource for storing
bevy_egui
mouse position. - Is used for storing Egui output.
- Adds all Egui resources and render graph nodes.
- Is used for storing Egui shapes and textures delta.
- A resource for storing global UI settings.
- A resource for storing
bevy_egui
user textures. - Egui’s render graph config.
- Stores physical size and scale factor, is used as a helper to calculate logical size.
Enums
- The
bevy_egui
plugin system sets. - The
bevy_egui
plugin startup system sets.
Functions
- Adds bevy_egui components to newly created windows.
- Updates textures painted by Egui.