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

upgrading egui to 0.24.1 #16

Merged
merged 1 commit into from
Dec 17, 2023
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ egui = { workspace = true }


[workspace.dependencies]
egui = { version = "0.23", default-features = false }
egui = { version = "0.24.1", default-features = false }
bytemuck = { version = "1", default-features = false }
tracing = { version = "0.1", default-features = false }
raw-window-handle = { version = "0.5" }
Expand Down
2 changes: 0 additions & 2 deletions crates/egui_window_glfw_passthrough/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ impl GlfwBackend {
]
.into(),
])),
pixels_per_point: Some(scale),
..Default::default()
};
tracing::info!(
Expand Down Expand Up @@ -455,7 +454,6 @@ impl GlfwBackend {
current_scale = x,
"content scale changed"
);
self.raw_input.pixels_per_point = Some(x);
self.scale = x;
self.window_size_logical = [
self.framebuffer_size_physical[0] as f32 / self.scale,
Expand Down
11 changes: 9 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ pub fn start<T: EguiOverlay + 'static>(user_data: T) {
};
overlap_app.enter_event_loop();
}

/// Implement this trait for your struct containing data you need. Then, call [`start`] fn with that data
pub trait EguiOverlay {
fn gui_run(
Expand All @@ -95,11 +96,16 @@ pub trait EguiOverlay {

let egui::FullOutput {
platform_output,
repaint_after,
textures_delta,
shapes,
pixels_per_point,
viewport_output,
} = egui_context.end_frame();
let meshes = egui_context.tessellate(shapes);
let meshes = egui_context.tessellate(shapes, pixels_per_point);
let repaint_after = viewport_output
.into_iter()
.map(|f| f.1.repaint_delay)
.collect::<Vec<Duration>>()[0];

default_gfx_backend.render_egui(meshes, textures_delta, glfw_backend.window_size_logical);
if glfw_backend.is_opengl() {
Expand All @@ -113,6 +119,7 @@ pub trait EguiOverlay {
Some((platform_output, repaint_after))
}
}

pub struct OverlayApp<T: EguiOverlay> {
pub user_data: T,
pub egui_context: Context,
Expand Down
Loading