|
@@ -26,14 +26,16 @@ pub fn init(title: &str) -> System {
|
|
|
.with_title(title.to_owned())
|
|
|
.with_dimensions(glutin::dpi::LogicalSize::new(1024f64, 768f64));
|
|
|
|
|
|
- let mut imgui = Context::create();
|
|
|
- imgui.set_ini_filename(Some(PathBuf::from("sampler.ini")));
|
|
|
-
|
|
|
- let mut platform = WinitPlatform::init(&mut imgui);
|
|
|
-
|
|
|
- let hidpi_factor = platform.hidpi_factor();
|
|
|
- dbg!(hidpi_factor);
|
|
|
- let font_size = (15.0 * hidpi_factor) as f32;
|
|
|
+ let mut imgui = Context::create();
|
|
|
+ imgui.set_ini_filename(Some(PathBuf::from("sampler.ini")));
|
|
|
+
|
|
|
+ let mut platform = WinitPlatform::init(&mut imgui);
|
|
|
+
|
|
|
+ let render_sys = RenderSystem::init(&mut imgui, builder, &events_loop);
|
|
|
+ let dpi = render_sys.window().get_hidpi_factor();
|
|
|
+ // let hidpi_factor = platform.hidpi_factor();
|
|
|
+ // dbg!(hidpi_factor);
|
|
|
+ let font_size = (16.0 * dpi) as f32;
|
|
|
imgui.fonts().add_font(&[
|
|
|
FontSource::TtfData {
|
|
|
data: include_bytes!("../fonts/IBMPlexMono-Regular.ttf"),
|
|
@@ -65,9 +67,12 @@ pub fn init(title: &str) -> System {
|
|
|
},
|
|
|
]);
|
|
|
|
|
|
- imgui.io_mut().font_global_scale = (0.9 / hidpi_factor) as f32;
|
|
|
+
|
|
|
+ // imgui.io_mut().font_global_scale = (0.9 / hidpi_factor) as f32;
|
|
|
+ imgui.io_mut().font_global_scale = (dpi) as f32;
|
|
|
+ imgui.style_mut().scale_all_sizes(dpi as f32);
|
|
|
+ dbg!(&dpi);
|
|
|
|
|
|
- let render_sys = RenderSystem::init(&mut imgui, builder, &events_loop);
|
|
|
platform.attach_window(imgui.io_mut(), render_sys.window(), HiDpiMode::Rounded);
|
|
|
System {
|
|
|
events_loop,
|