Johann Woelper 4 anni fa
parent
commit
a2053b684a
3 ha cambiato i file con 43 aggiunte e 7 eliminazioni
  1. 5 0
      sampler.ini
  2. 7 3
      src/base.rs
  3. 31 4
      src/main.rs

+ 5 - 0
sampler.ini

@@ -48,3 +48,8 @@ Pos=400,140
 Size=324,183
 Collapsed=0
 
+[Window][settings]
+Pos=60,60
+Size=300,100
+Collapsed=0
+

+ 7 - 3
src/base.rs

@@ -270,9 +270,13 @@ impl Pattern {
             for y in 0..self.ysize {
                 if let Some(snd) = self.sounds.get_mut(&(x,y)) {
                     println!("RELOAD {:?}", &snd.name);
-                    snd.data = snd.updated_drom_source().unwrap().data;
-                    // let s = snd.reload_data().unwrap();
-                    // snd.data = s.data.clone();
+
+                    // snd.data = snd.updated_drom_source().unwrap().data;
+                    match snd.updated_drom_source() {
+                        Ok(newdata) => snd.data = newdata.data,
+                        Err(e) => println!("ERROR LOADING {:?}", e)
+                    }
+
                 }
             }
         }

+ 31 - 4
src/main.rs

@@ -57,13 +57,17 @@ fn main() {
     let mut active_sound: Option<Sound> = None;
 
     let mut system = support_ogl::init(file!());
-    let style = system.imgui.style_mut();
+    let display = system.imgui.io().display_size;
+    let pixel_count = display[0]*display[1];
+    dbg!(pixel_count);
+    let mut style = system.imgui.style_mut();
     style.window_rounding = 1.5;
     style.anti_aliased_lines = false;
     style.anti_aliased_fill = false;
-    // ui.push_style_color();
-    let PURPLE = [0.07, 0.05, 0.27, 1.00];
+    style.scale_all_sizes(1.5);
 
+    // ui.push_style_color();
+    
     // style.colors[StyleColor::Text]                   = ImVec4(1.00, 1.00, 1.00, 1.00);
     // // style.colors[ImGuiCol_WindowBg]               = ImVec4(0.03f, 0.03f, 0.03f, 1.00f);
     // // style.colors[ImGuiCol_FrameBg]                = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
@@ -88,7 +92,8 @@ fn main() {
     // // style.colors[ImGuiCol_TabHovered]             = ImVec4(0.15f, 0.05f, 0.27f, 1.00f);
     // // style.colors[ImGuiCol_TabActive]              = ImVec4(0.21f, 0.14f, 0.91f, 1.00f);
     // // style.colors.
-
+    
+    let PURPLE = [0.07, 0.05, 0.27, 1.00];
     system.main_loop(move |_, ui| {
 
         let colors = ui.push_style_colors(&[
@@ -96,8 +101,11 @@ fn main() {
             (StyleColor::Button, PURPLE),
             (StyleColor::TitleBgActive, PURPLE),
             (StyleColor::ResizeGrip, PURPLE),
+            (StyleColor::CheckMark, PURPLE),
+            (StyleColor::Tab, PURPLE),
         ]);
 
+
         Window::new(im_str!("sources"))
             // .resizable(false)
             .position([400.0, 140.0], Condition::Appearing)
@@ -282,6 +290,25 @@ fn main() {
                 }
             });
     
+            Window::new(im_str!("settings"))
+            .size([300.0, 100.0], Condition::FirstUseEver)
+            .build(ui, || {
+               
+                let mut scale = 1.0;
+                if ui.drag_float(im_str!("speed"), &mut scale)
+                .min(0.0)
+                .max(3.0)
+                .speed(0.01)
+                .build() {
+                    // let s = system.imgui.style_mut();
+                    
+                    // s.scale_all_sizes(scale);
+
+                }
+
+            });
+
+
             colors.pop(&ui);
     
         });