-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* egui 0.29 support * Configure manual run via EguiSettings, make settings a component * Fix clippy warnings for no-default-features * Make queries of the simple_multipass example consitent * Rename BeginFrame to BeginPass --------- Co-authored-by: mvlabat <mvlabat@gmail.com>
- Loading branch information
Showing
11 changed files
with
198 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use std::num::NonZero; | ||
|
||
use bevy::prelude::*; | ||
use bevy_egui::{EguiContext, EguiFullOutput, EguiInput, EguiPlugin, EguiSettings, EguiStartupSet}; | ||
|
||
fn main() { | ||
App::new() | ||
.add_plugins(DefaultPlugins) | ||
.add_plugins(EguiPlugin) | ||
.add_systems( | ||
PreStartup, | ||
configure_context.after(EguiStartupSet::InitContexts), | ||
) | ||
.add_systems(Update, ui_example_system) | ||
.run(); | ||
} | ||
|
||
fn configure_context(mut egui_settings: Query<&mut EguiSettings>) { | ||
egui_settings.single_mut().run_manually = true; | ||
} | ||
|
||
fn ui_example_system(mut contexts: Query<(&mut EguiContext, &mut EguiInput, &mut EguiFullOutput)>) { | ||
let (mut ctx, mut egui_input, mut egui_full_output) = contexts.single_mut(); | ||
|
||
let ui = |ctx: &egui::Context| { | ||
egui::Window::new("Hello").show(ctx, |ui| { | ||
let passes = ui | ||
.ctx() | ||
.viewport(|viewport| viewport.output.num_completed_passes) | ||
+ 1; | ||
ui.label(format!("Passes: {}", passes)); | ||
ui.ctx().request_discard("Trying to reach max limit"); | ||
}); | ||
}; | ||
|
||
let ctx = ctx.get_mut(); | ||
ctx.memory_mut(|memory| { | ||
memory.options.max_passes = NonZero::new(5).unwrap(); | ||
}); | ||
|
||
**egui_full_output = Some(ctx.run(egui_input.take(), ui)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.