Skip to content

Commit

Permalink
fix egui blurry text
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazariglez committed Jun 8, 2024
1 parent 5d3ac6f commit f0d05ff
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/notan_egui/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct EguiPlugin {
platform_output: Option<egui::PlatformOutput>,
latest_evt_was_touch: bool,
needs_repaint: bool,
pixels_per_point: f32,
}

#[allow(clippy::derivable_impls)]
Expand All @@ -29,6 +30,7 @@ impl Default for EguiPlugin {
platform_output: Default::default(),
latest_evt_was_touch: Default::default(),
needs_repaint: Default::default(),
pixels_per_point: Default::default(),
}
}
}
Expand Down Expand Up @@ -294,6 +296,12 @@ impl Plugin for EguiPlugin {
}

fn update(&mut self, app: &mut App, _assets: &mut Assets) -> Result<AppFlow, String> {
let dpi = app.window().dpi() as f32;
if dpi != self.pixels_per_point {
self.pixels_per_point = dpi;
self.ctx.set_pixels_per_point(self.pixels_per_point);
}

self.raw_input.time = Some(app.timer.elapsed_f32() as _);
self.raw_input.predicted_dt = app.timer.delta_f32();

Expand Down

0 comments on commit f0d05ff

Please sign in to comment.