sounds
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -172,7 +172,8 @@ impl MyApp {
|
||||
}
|
||||
Message::ChangeSound(i, s) => {
|
||||
self.poly_frame.polygons[i].sound =
|
||||
StaticSoundData::from_file(&s).expect("Fail to load audio");
|
||||
StaticSoundData::from_file(format!("./assets/{}", s))
|
||||
.expect("Fail to load audio");
|
||||
self.poly_frame.polygons[i].sound_name = s;
|
||||
}
|
||||
}
|
||||
@@ -190,11 +191,12 @@ impl MyApp {
|
||||
.map(|polygon| {
|
||||
let current_index = i;
|
||||
i += 1;
|
||||
let entries = fs::read_dir("./assets/")
|
||||
let mut entries: Vec<String> = fs::read_dir("./assets")
|
||||
.unwrap()
|
||||
.map(|res| res.map(|e| e.path().to_str().unwrap().to_string()))
|
||||
.collect::<Result<Vec<_>, io::Error>>()
|
||||
.unwrap();
|
||||
.filter_map(|res| res.ok())
|
||||
.map(|e| e.path().file_name().unwrap().to_str().unwrap().to_string())
|
||||
.collect();
|
||||
entries.sort();
|
||||
|
||||
row![
|
||||
text(&polygon.name),
|
||||
|
||||
Reference in New Issue
Block a user