|
|
@ -71,26 +71,23 @@ impl PipeDash {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
fn side_panel(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
|
|
|
|
|
|
|
|
|
|
|
impl eframe::App for PipeDash {
|
|
|
|
|
|
|
|
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
|
|
|
|
|
|
|
use Message::*;
|
|
|
|
|
|
|
|
use Color::*;
|
|
|
|
|
|
|
|
ctx.set_pixels_per_point(2f32);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
egui::SidePanel::left("level_picker").default_width(100f32).show(ctx, |ui| {
|
|
|
|
egui::SidePanel::left("level_picker").default_width(100f32).show(ctx, |ui| {
|
|
|
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
|
|
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
|
|
|
ui.with_layout(egui::Layout::top_down_justified(egui::Align::Min), |ui| {
|
|
|
|
ui.with_layout(egui::Layout::top_down_justified(egui::Align::Min), |ui| {
|
|
|
|
for (idx, level) in self.level_list.iter().enumerate() {
|
|
|
|
for (idx, level) in self.level_list.iter().enumerate() {
|
|
|
|
if ui.selectable_label(self.selected_level == Some(idx), level.display_name()).clicked() {
|
|
|
|
if ui.selectable_label(self.selected_level == Some(idx), level.display_name()).clicked() {
|
|
|
|
self.msg_queue.push_back(LevelSelected(idx));
|
|
|
|
self.msg_queue.push_back(Message::LevelSelected(idx));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn center_panel(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
|
|
|
|
|
|
|
use Message::*;
|
|
|
|
|
|
|
|
use Color::*;
|
|
|
|
egui::CentralPanel::default().show(ctx, |ui| {
|
|
|
|
egui::CentralPanel::default().show(ctx, |ui| {
|
|
|
|
ui.vertical_centered_justified(|ui| {
|
|
|
|
ui.vertical_centered_justified(|ui| {
|
|
|
|
ui.horizontal_top(|ui| {
|
|
|
|
ui.horizontal_top(|ui| {
|
|
|
@ -115,7 +112,9 @@ impl eframe::App for PipeDash {
|
|
|
|
ui.add(self.editor.widget());
|
|
|
|
ui.add(self.editor.widget());
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn handle_messages(&mut self) {
|
|
|
|
for message in self.msg_queue.drain(..) {
|
|
|
|
for message in self.msg_queue.drain(..) {
|
|
|
|
println!("{:?}", message);
|
|
|
|
println!("{:?}", message);
|
|
|
|
match message {
|
|
|
|
match message {
|
|
|
@ -130,6 +129,17 @@ impl eframe::App for PipeDash {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl eframe::App for PipeDash {
|
|
|
|
|
|
|
|
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
|
|
|
|
|
|
|
ctx.set_pixels_per_point(2f32);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.side_panel(ctx, frame);
|
|
|
|
|
|
|
|
self.center_panel(ctx, frame);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.handle_messages();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
fn main() {
|
|
|
|
let app: PipeDash;
|
|
|
|
let app: PipeDash;
|
|
|
|
let opts = eframe::NativeOptions::default();
|
|
|
|
let opts = eframe::NativeOptions::default();
|
|
|
|