remove comment in french and usless things, add remove buttons

This commit is contained in:
2025-06-03 15:26:06 +02:00
parent b732708ce3
commit 4d4347a0d0
2 changed files with 18 additions and 17 deletions

View File

@@ -29,6 +29,7 @@ enum Message {
Tick,
AddPolygon(String),
ChangeTeta(usize, f32),
Remove(usize),
}
struct MyApp {
@@ -106,6 +107,9 @@ impl MyApp {
}
self.time_last_frame = Instant::now();
}
Message::Remove(i) => {
self.poly_frame.polygons.remove(i - 1);
}
Message::ChangeTeta(i, teta) => self.poly_frame.polygons[i].global_teta = teta,
}
}
@@ -119,7 +123,7 @@ impl MyApp {
.iter()
.map(|polygon| {
let current_index = i;
i += 1; // Incrémenter l'index pour le prochain polygone
i += 1;
row![
text(&polygon.name),
@@ -128,13 +132,13 @@ impl MyApp {
polygon.global_teta,
move |f| { Message::ChangeTeta(current_index, f) }
)
.step(2.0 * PI / 42f32)
.step(2.0 * PI / 42f32),
button("Remove").on_press(Message::Remove(i))
]
.into()
})
.collect();
// Utiliser Column::with_children pour ajouter dynamiquement les boutons
let polygon_column = Column::with_children(polygon_rows);
column![
text("Polymusic").size(32.0),
@@ -164,12 +168,3 @@ impl MyApp {
time::every(Duration::from_millis(16)).map(|_| Message::Tick)
}
}
/*
fn do_sound(file_name: &str) {
let (_stream, handle) = rodio::OutputStream::try_default().unwrap();
let sink = rodio::Sink::try_new(&handle).unwrap();
let file = std::fs::File::open(file_name).unwrap();
sink.append(rodio::Decoder::new(BufReader::new(file)).unwrap());
sink.sleep_until_end();
}*/