From 9144681bad2d7795afa36f5c26325aac940c4fa5 Mon Sep 17 00:00:00 2001 From: Andrew Golovashevich Date: Thu, 22 Jan 2026 06:05:50 +0300 Subject: [PATCH] Cleanup and adjusting board colors --- lab1/src/algo/misc.rs | 1 - lab1/src/main.rs | 21 ++++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/lab1/src/algo/misc.rs b/lab1/src/algo/misc.rs index 1df21bf..cf64957 100644 --- a/lab1/src/algo/misc.rs +++ b/lab1/src/algo/misc.rs @@ -1,5 +1,4 @@ use super::Board; -use rand::random_range; use std::ops::Range; pub(super) fn initializeBoard(b: &mut Board) { diff --git a/lab1/src/main.rs b/lab1/src/main.rs index 1d7e0b7..c13e713 100644 --- a/lab1/src/main.rs +++ b/lab1/src/main.rs @@ -1,12 +1,11 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release -#![expect(rustdoc::missing_crate_level_docs)] // it's an example mod algo; use eframe::egui; use eframe::egui::{CornerRadius, Frame, Ui}; use eframe::emath::Numeric; -use eframe::epaint::{Color32, Pos2, Rect, RectShape, Rounding, Shape}; +use eframe::epaint::{Color32, Pos2, Rect}; use rand::SeedableRng; use std::ops::RangeInclusive; use std::time::{SystemTime, UNIX_EPOCH}; @@ -19,12 +18,7 @@ fn main() -> eframe::Result { eframe::run_native( "Annealing Simulation for Chess Queens Task", options, - Box::new(|cc| { - // This gives us image support: - // egui_extras::install_image_loaders(&cc.egui_ctx); - - Ok(Box::::default()) - }), + Box::new(|_cc| Ok(Box::::default())), ) } @@ -133,7 +127,8 @@ impl eframe::App for MyApp { .with_inner_size([ 10.0 * self.boardSize as f32, 10.0 * self.boardSize as f32, - ]), + ]) + .with_resizable(false), |ui, _| { egui::CentralPanel::default() .frame(Frame::default().inner_margin(0.0)) @@ -142,7 +137,7 @@ impl eframe::App for MyApp { painter.rect_filled( ui.available_rect_before_wrap(), CornerRadius::from(0), - Color32::from_rgb(0, 0, 0), + Color32::from_rgb(50, 50, 150), ); for y in 0..self.boardSize { @@ -157,7 +152,7 @@ impl eframe::App for MyApp { ), ), CornerRadius::from(0), - Color32::from_rgb(255, 255, 255), + Color32::from_rgb(200, 200, 255), ); } } @@ -166,8 +161,8 @@ impl eframe::App for MyApp { for i in 0..self.boardSize { painter.circle_filled( Pos2::new((10 * board[i] + 5) as f32, (10 * i + 5) as f32), - 4.0, - Color32::from_rgb(255, 0, 0), + 3.0, + Color32::from_rgb(255, 50, 0), ); }