diff --git a/lab1/src/main.rs b/lab1/src/main.rs index c1d37c4..cf890a9 100644 --- a/lab1/src/main.rs +++ b/lab1/src/main.rs @@ -7,7 +7,10 @@ use bgtu_ai_utility::gui::{boot_eframe, subwindow}; use eframe::egui; fn main() -> eframe::Result { - return boot_eframe(|| gui::MyApp::new()); + return boot_eframe( + "Annealing Simulation for Chess Queens Task", + || gui::MyApp::new() + ); } impl eframe::App for gui::MyApp { @@ -19,17 +22,14 @@ impl eframe::App for gui::MyApp { None => {} Some(board) => { subwindow( - ui, - "board", - "Board", + ui, "board", "Board", |vb| { return vb .with_inner_size(gui::get_board_size(self.boardSize)) .with_resizable(false); }, |ui| gui::draw_board(ui, board), - ) - .on_close(|| self.result = None); + ).on_close(|| self.result = None); } }; }); diff --git a/lab2/src/main.rs b/lab2/src/main.rs index af29832..cc88455 100644 --- a/lab2/src/main.rs +++ b/lab2/src/main.rs @@ -8,7 +8,10 @@ use bgtu_ai_utility::gui::boot_eframe; use eframe::egui; fn main() -> eframe::Result { - return boot_eframe(|| gui::MyApp::new()); + return boot_eframe( + "Adaptive Resonance Theory calculater", + || gui::MyApp::new() + ); } impl eframe::App for gui::MyApp { diff --git a/lab3/src/main.rs b/lab3/src/main.rs index 4f7b5ac..e39a680 100644 --- a/lab3/src/main.rs +++ b/lab3/src/main.rs @@ -16,7 +16,10 @@ use std::collections::HashSet; use bgtu_ai_utility::graph::CompleteGraph; fn main() -> eframe::Result { - return boot_eframe(|| MyApp::new()); + return boot_eframe( + "Ants simulation", + || MyApp::new() + ); } enum GlobalState { diff --git a/lab4/src/main.rs b/lab4/src/main.rs index 1918f87..888b6a2 100644 --- a/lab4/src/main.rs +++ b/lab4/src/main.rs @@ -12,7 +12,10 @@ use egui_extras::{Column, TableBuilder}; use std::cmp::min; fn main() -> eframe::Result { - return boot_eframe(|| MyApp::new()); + return boot_eframe( + "Neural net", + || MyApp::new() + ); } diff --git a/utility/src/gui/boot.rs b/utility/src/gui/boot.rs index ea82f11..89e4bd9 100644 --- a/utility/src/gui/boot.rs +++ b/utility/src/gui/boot.rs @@ -1,12 +1,15 @@ use eframe::egui; -pub fn boot_eframe(init_data: impl FnOnce() -> T) ->eframe::Result { +pub fn boot_eframe( + title: &str, + init_data: impl FnOnce() -> T +) ->eframe::Result { let options = eframe::NativeOptions { viewport: egui::ViewportBuilder::default().with_inner_size([640.0, 400.0]), ..Default::default() }; eframe::run_native( - "Annealing Simulation for Chess Queens Task", + title, options, Box::new(|_cc| Ok(Box::::new(init_data()))), )