Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update egui to 0.24 #305

Merged
merged 1 commit into from
Feb 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## UNRELEASED

- Updated EGUI to `0.24`.

## v0.11.0 - 18/10/2023

- Added traits `Serialize` and `Deserialize` to `Color` with the feature `serde` enabled.
Expand Down
69 changes: 50 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ features = ["default", "glyph", "egui", "text", "extra", "audio", "links", "drop
lto = true

[dev-dependencies]
egui_demo_lib = "0.23.0"
egui_demo_lib = "0.24.0"
bytemuck = "1.14.0"

[[example]]
Expand Down
2 changes: 1 addition & 1 deletion crates/notan_egui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ notan_macro.workspace = true
log.workspace = true
bytemuck.workspace = true

egui = { version = "0.23.0", features = ["bytemuck"] }
egui = { version = "0.24.0", features = ["bytemuck"] }

[features]
links = []
Expand Down
14 changes: 7 additions & 7 deletions crates/notan_egui/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ impl EguiPlugin {

let egui::FullOutput {
platform_output,
repaint_after,
textures_delta,
shapes,
pixels_per_point,
viewport_output,
} = self.ctx.run(new_input, run_ui);

let needs_update_textures = !textures_delta.is_empty();
let needs_repaint = repaint_after.is_zero() || needs_update_textures;
let needs_repaint = viewport_output.values().any(|output| output.repaint_delay.is_zero()) || needs_update_textures;
Copy link
Contributor Author

@z33ky z33ky Dec 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my best guess. FullOutput::repaint_after was removed in emilk/egui#3172 and I'm not sure how dealing with multiple viewports effects notan.


// On post frame needs repaint is set to false
// set it again if true after a egui output.
Expand All @@ -62,7 +63,7 @@ impl EguiPlugin {

Output {
ctx: self.ctx.clone(),
shapes: RefCell::new(Some(shapes)),
shapes: RefCell::new(Some((shapes, pixels_per_point))),
textures_delta,
clear_color: None,
needs_repaint,
Expand All @@ -72,7 +73,7 @@ impl EguiPlugin {

pub struct Output {
ctx: egui::Context,
shapes: RefCell<Option<Vec<egui::epaint::ClippedShape>>>,
shapes: RefCell<Option<(Vec<egui::epaint::ClippedShape>, f32)>>,
textures_delta: egui::TexturesDelta,
clear_color: Option<Color>,
needs_repaint: bool,
Expand Down Expand Up @@ -101,7 +102,7 @@ impl GfxRenderer for Output {
"Missing EguiExtension. You may need to add 'EguiConfig' to notan.".to_string()
})?;

if let Some(shapes) = self.shapes.borrow_mut().take() {
if let Some((shapes, pixels_per_point)) = self.shapes.borrow_mut().take() {
if self.clear_color.is_some() {
let mut clear_renderer = device.create_renderer();
clear_renderer.begin(Some(ClearOptions {
Expand All @@ -116,7 +117,7 @@ impl GfxRenderer for Output {
}
}

let meshes = self.ctx.tessellate(shapes);
let meshes = self.ctx.tessellate(shapes, pixels_per_point);
ext.paint_and_update_textures(device, meshes, &self.textures_delta, target)?;
}

Expand Down Expand Up @@ -294,7 +295,6 @@ impl Plugin for EguiPlugin {
}

fn update(&mut self, app: &mut App, _assets: &mut Assets) -> Result<AppFlow, String> {
self.raw_input.pixels_per_point = Some(app.window().dpi() as _);
self.raw_input.time = Some(app.timer.elapsed_f32() as _);
self.raw_input.predicted_dt = app.timer.delta_f32();

Expand Down
Loading