Expand description
This crate provides a 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, EguiContext, EguiPlugin};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugin(EguiPlugin)
// Systems that create Egui widgets should be run during the `CoreStage::Update` stage,
// or after the `EguiSystem::BeginFrame` system (which belongs to the `CoreStage::PreUpdate` stage).
.add_system(ui_example)
.run();
}
fn ui_example(mut egui_context: ResMut<EguiContext>) {
egui::Window::new("Hello").show(egui_context.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 resource for storing
bevy_egui
context.Is used for storing the input passed to Egui in the
EguiRenderInputContainer
resource.Represents a texture allocated and painted by Egui.
Contains textures allocated and painted by Egui.
Is used for storing Egui output ine the
EguiOutputContainer
resource..Stores
EguiOutputContainer
for each window.Adds all Egui resources and render graph nodes.
Stores
EguiInput
for each window.Is used for storing Egui shapes in the
EguiRenderOutputContainer
resource.Stores
EguiRenderOutput
for each window.A resource for storing global UI settings.
Stores
WindowSize
for each window.Egui’s render graph config.
Stores physical size and scale factor, is used as a helper to calculate logical size.
Enums
The names of
bevy_egui
startup systems.The names of egui systems.
Functions
Set up egui render pipeline.
Updates textures painted by Egui.