Crate bevy_egui[−][src]
This crate provides a egui integration for the Bevy game engine.
Features:
- Desktop and web (bevy_webgl2) platforms support
- Clipboard (web support is limited to the same window, see rust-windowing/winit#1829)
- Opening URLs
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.
Trying out
An example WASM project is live at mvlabat.github.io/bevy_egui_web_showcase [source].
Note that in order to use bevy_egui
in WASM you need bevy_webgl2 of at least 0.4.1
version.
Usage
Here’s a minimal usage example:
use bevy::prelude::*; use bevy_egui::{egui, EguiContext, EguiPlugin}; fn main() { App::build() .add_plugins(DefaultPlugins) .add_plugin(EguiPlugin) .add_system(ui_example.system()) .run(); } fn ui_example(mut egui_context: ResMut<EguiContext>) { let ctx = &mut egui_context.ctx; egui::Window::new("Hello").show(ctx, |ui| { ui.label("world"); }); }
For a more advanced example, see examples/ui.rs.
cargo run --example ui --features="bevy/x11 bevy/png bevy/bevy_wgpu"
See also
Re-exports
pub use egui; |
Modules
node | The names of |
stage | The names of |
Structs
EguiContext | A resource that is used to store |
EguiInput | A resource that stores the input passed to Egui. It gets reset during the stage::UI_FRAME stage. |
EguiOutput | A resource for storing Egui output. |
EguiPlugin | Adds all egui resources and render graph nodes. |
EguiSettings | A resource containing global UI settings. |
EguiShapes | A resource for storing Egui shapes. |
Constants
EGUI_PIPELINE_HANDLE | A handle pointing to the egui [PipelineDescriptor]. |
EGUI_TEXTURE_RESOURCE_BINDING_NAME | Name of the texture uniform. |
EGUI_TRANSFORM_RESOURCE_BINDING_NAME | Name of the transform uniform. |