Skip to content

Commit

Permalink
Better DPI handling for egui
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlcctrlv committed Mar 12, 2023
1 parent 0fb924b commit dab688e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ lazy_static = "1.4"
#imgui-skia-renderer = {git = "https://github.com/MFEK/imgui-skia-renderer.rlib", branch = "main"}
#imgui-skia-renderer = { path = "../imgui-skia-renderer.rlib" } # for development
egui = "0.21.0"
egui_skia = "0.2.1"
egui-sdl2-event = { git = "https://github.com/MFEK/egui-sdl2-event.rlib" }
egui_skia = { git = "https://github.com/MFEK/egui_skia.rlib", branch = "master" }
egui-sdl2-event = { git = "https://github.com/MFEK/egui-sdl2-event.rlib", branch = "master" }
# For argument parsing
clap = "3.0"

Expand Down
3 changes: 2 additions & 1 deletion src/user_interface/egui_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ pub struct EguiManager {

impl EguiManager {
pub fn new(interface: &mut Interface) -> Self {
let dpi = 1.0 / interface.set_dpi_from_os();
let egui_sdl2 = egui_sdl2_event::EguiSDL2State::new(
&interface.sdl_window,
&interface.sdl_context.video().unwrap(),
DpiMode::Auto,
DpiMode::Custom(dpi),
);
let egui_skia = egui_skia::EguiSkia::new();
return EguiManager {
Expand Down
2 changes: 0 additions & 2 deletions src/user_interface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ impl Interface {
fb_info,
};

iself.adjust_viewport_by_os_dpi();

iself
}

Expand Down

0 comments on commit dab688e

Please sign in to comment.