wde_editor/
lib.rs

1//! A simple editor plugin on top of `wde_egui` that provides an editor interface.
2//!
3//! # Example
4//! To create as an example a top-level menu item "Terrain" with a submenu "Paint", you can do the following:
5//! ```rust
6//! fn update(ctx: Res<UIContext>, ui_menu: Res<UIMenu>) {
7//!     UIWindow::new("Paint Debug")
8//!         .default_size([1100.0, 600.0])
9//!         .open(ui_menu.clicked_mut("Terrain/Paint"))
10//!         .show(&ctx.0, |_ui| {
11//!              // Terrain paint functionality goes here...
12//!         });
13//! }
14//! ```
15//! To see all the available UI components and how to use them, check out the [`egui`] documentation, which is the underlying UI library used by `wde_egui` and thus also by this editor plugin.
16//!
17//! # Default Panels
18//! This crate also provides basic panels such as ones for inspecting entities and assets, as well as a simple overlay system for drawing UI on top of the game viewport.
19
20use bevy::prelude::*;
21use wde_egui::EguiPlugin;
22
23use crate::{panels::PanelsPlugin, ui::EditorUIMenu};
24
25mod panels;
26mod ui;
27mod ui_textures;
28
29#[doc(hidden)]
30pub mod prelude {
31    // Re-export egui types for easier access in editor code
32    pub use wde_egui::prelude::EguiContext as UIContext;
33    pub use wde_egui::prelude::egui::Window as UIWindow;
34
35    // Re-export editor UI types
36    pub use wde_egui::prelude::egui::{
37        Button, Checkbox, CollapsingHeader, Color32, ColorImage, ComboBox, DragValue, FontId,
38        Label, ScrollArea, Separator, Slider, TextEdit
39    };
40    pub mod ui {
41        pub use wde_egui::prelude::*;
42    }
43
44    // Re-export editor types
45    pub use super::ui::UIMenu;
46    pub use super::ui_textures::{UITextureHandle, UITextures};
47}
48
49pub struct EditorPlugin;
50impl Plugin for EditorPlugin {
51    fn build(&self, app: &mut App) {
52        app.add_plugins((EguiPlugin, EditorUIMenu, PanelsPlugin));
53    }
54}