|
@@ -63,35 +63,8 @@ fn main() {
|
|
style.window_rounding = 1.5;
|
|
style.window_rounding = 1.5;
|
|
style.anti_aliased_lines = false;
|
|
style.anti_aliased_lines = false;
|
|
style.anti_aliased_fill = false;
|
|
style.anti_aliased_fill = false;
|
|
-
|
|
|
|
- // 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);
|
|
|
|
- // // style.colors[ImGuiCol_FrameBgHovered] = ImVec4(0.11f, 0.08f, 0.44f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_FrameBgActive] = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_TitleBg] = ImVec4(0.11f, 0.11f, 0.11f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_TitleBgActive] = ImVec4(0.14f, 0.05f, 0.96f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_ScrollbarBg] = ImVec4(0.03f, 0.03f, 0.03f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_CheckMark] = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_SliderGrab] = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_SliderGrabActive] = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_Button] = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_ButtonHovered] = ImVec4(0.18f, 0.12f, 0.78f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_ButtonActive] = ImVec4(0.20f, 0.13f, 0.88f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_Header] = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_SeparatorHovered] = ImVec4(0.13f, 0.07f, 0.78f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_SeparatorActive] = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_ResizeGrip] = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.19f, 0.12f, 0.85f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_ResizeGripActive] = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
|
|
|
|
- // // style.colors[ImGuiCol_Tab] = ImVec4(0.07f, 0.05f, 0.27f, 1.00f);
|
|
|
|
- // // 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];
|
|
|
|
|
|
+ const PURPLE: [f32; 4] = [0.07, 0.05, 0.27, 1.00];
|
|
system.main_loop(move |_, ui| {
|
|
system.main_loop(move |_, ui| {
|
|
|
|
|
|
let colors = ui.push_style_colors(&[
|
|
let colors = ui.push_style_colors(&[
|
|
@@ -187,7 +160,7 @@ fn main() {
|
|
active_pattern.name = imstr_name.to_string();
|
|
active_pattern.name = imstr_name.to_string();
|
|
};
|
|
};
|
|
|
|
|
|
- let button_size: f32 = 16.0;
|
|
|
|
|
|
+ let button_size: f32 = 20.0;
|
|
|
|
|
|
ui.drag_int(im_str!("repeat"), &mut active_pattern.repeat)
|
|
ui.drag_int(im_str!("repeat"), &mut active_pattern.repeat)
|
|
.max(32)
|
|
.max(32)
|
|
@@ -248,37 +221,50 @@ fn main() {
|
|
Window::new(im_str!("sound"))
|
|
Window::new(im_str!("sound"))
|
|
.size([300.0, 100.0], Condition::FirstUseEver)
|
|
.size([300.0, 100.0], Condition::FirstUseEver)
|
|
.build(ui, || {
|
|
.build(ui, || {
|
|
- // let snd = &active_bar.sounds[pattern_col];
|
|
|
|
|
|
+ // check if active sounds is some
|
|
if let Some(s) = &mut active_sound {
|
|
if let Some(s) = &mut active_sound {
|
|
ui.text(im_str!("name {}", s.name));
|
|
ui.text(im_str!("name {}", s.name));
|
|
- // let _ = DragFloat::new()
|
|
|
|
|
|
+
|
|
ui.drag_float(im_str!("volume"), &mut s.volume)
|
|
ui.drag_float(im_str!("volume"), &mut s.volume)
|
|
.min(-1.0)
|
|
.min(-1.0)
|
|
.max(2.0)
|
|
.max(2.0)
|
|
.speed(0.01)
|
|
.speed(0.01)
|
|
.build();
|
|
.build();
|
|
|
|
+
|
|
ui.drag_float(im_str!("speed"), &mut s.speed)
|
|
ui.drag_float(im_str!("speed"), &mut s.speed)
|
|
.min(0.0)
|
|
.min(0.0)
|
|
.max(2.0)
|
|
.max(2.0)
|
|
.speed(0.01)
|
|
.speed(0.01)
|
|
- .build();
|
|
|
|
|
|
+ .build();
|
|
|
|
+
|
|
ui.drag_int(im_str!("roll"), &mut s.roll)
|
|
ui.drag_int(im_str!("roll"), &mut s.roll)
|
|
.max(32)
|
|
.max(32)
|
|
.speed(0.05)
|
|
.speed(0.05)
|
|
.build();
|
|
.build();
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ if ui.small_button(&im_str!("adjust speed to pattern")) {
|
|
|
|
+ if let Some(sd) = s.duration() {
|
|
|
|
+ let ad = active_pattern.duration();
|
|
|
|
+ dbg!(&sd.as_millis());
|
|
|
|
+ let scale = sd.as_millis() as f32 / ad as f32;
|
|
|
|
+ dbg!(&scale);
|
|
|
|
+ s.speed = scale;
|
|
|
|
+ }
|
|
|
|
+ // dbg!(&l);
|
|
|
|
+ // let bpm = active_pattern.bpm;
|
|
|
|
+ }
|
|
ui.checkbox(im_str!("reverse"), &mut s.reverse);
|
|
ui.checkbox(im_str!("reverse"), &mut s.reverse);
|
|
|
|
|
|
- if ui.small_button(&im_str!("play")) {
|
|
|
|
- s.play(&dev);
|
|
|
|
- }
|
|
|
|
|
|
+ if ui.small_button(&im_str!("play")) {s.play(&dev)}
|
|
|
|
|
|
}
|
|
}
|
|
- if ui.small_button(&im_str!("clear")) {
|
|
|
|
- active_sound = None;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ if ui.small_button(&im_str!("clear")) {active_sound = None}
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
Window::new(im_str!("tracks"))
|
|
Window::new(im_str!("tracks"))
|
|
.size([300.0, 100.0], Condition::FirstUseEver)
|
|
.size([300.0, 100.0], Condition::FirstUseEver)
|
|
.build(ui, || {
|
|
.build(ui, || {
|
|
@@ -287,26 +273,27 @@ fn main() {
|
|
active_pattern.play(&dev);
|
|
active_pattern.play(&dev);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
- 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);
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
- });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ // 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!("size"), &mut scale)
|
|
|
|
+ // .min(0.0)
|
|
|
|
+ // .max(3.0)
|
|
|
|
+ // .speed(0.01)
|
|
|
|
+ // .build() {
|
|
|
|
+ // // let s = system.imgui.style_mut();
|
|
|
|
+ // // s.scale_all_sizes(scale);
|
|
|
|
+ // }
|
|
|
|
+ // });
|
|
|
|
+
|
|
|
|
+ // Discard color token
|
|
colors.pop(&ui);
|
|
colors.pop(&ui);
|
|
|
|
|
|
});
|
|
});
|