Johann Woelper 4 سال پیش
والد
کامیت
b0394d171f
3فایلهای تغییر یافته به همراه29 افزوده شده و 21 حذف شده
  1. 9 9
      sampler.ini
  2. 5 2
      src/main.rs
  3. 15 10
      src/support_ogl/mod.rs

+ 9 - 9
sampler.ini

@@ -9,8 +9,8 @@ Size=300,100
 Collapsed=0
 
 [Window][sources]
-Pos=400,140
-Size=182,665
+Pos=419,266
+Size=361,711
 Collapsed=0
 
 [Window][ImGui Demo]
@@ -29,17 +29,17 @@ Size=328,168
 Collapsed=0
 
 [Window][sound]
-Pos=24,-2
-Size=290,149
+Pos=43,383
+Size=354,269
 Collapsed=0
 
 [Window][tracks]
-Pos=50,438
-Size=300,100
+Pos=761,787
+Size=300,160
 Collapsed=0
 
 [Window][pattern]
-Pos=30,177
+Pos=609,442
 Size=684,283
 Collapsed=0
 
@@ -49,7 +49,7 @@ Size=324,183
 Collapsed=0
 
 [Window][settings]
-Pos=60,60
-Size=300,100
+Pos=986,236
+Size=300,160
 Collapsed=0
 

+ 5 - 2
src/main.rs

@@ -40,11 +40,15 @@ fn collect_patterns (root: &str) -> Vec<Pattern> {
 
 fn main() {
 
-    let index: Vec<usize> = "0,1".split(",").map(|s| s.parse::<usize>().unwrap_or_default()).collect();
 
     env_logger::init();
     let dev = rodio::default_output_device().unwrap();
     
+let devs = rodio::output_devices();
+    for d in devs {
+        dbg!("dev");
+    }
+
     let mut sounds = collect_sounds("media");
     let mut patterns = collect_patterns("patterns");
     
@@ -64,7 +68,6 @@ fn main() {
     style.window_rounding = 1.5;
     style.anti_aliased_lines = false;
     style.anti_aliased_fill = false;
-    style.scale_all_sizes(1.5);
 
     // ui.push_style_color();
     

+ 15 - 10
src/support_ogl/mod.rs

@@ -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,