This commit is contained in:
2025-08-19 21:45:42 +02:00
parent b7db734cc7
commit 7eae2f7b0c

View File

@@ -1,4 +1,3 @@
use crate::color::color_serde;
use std::f32::consts::PI;
@@ -200,8 +199,13 @@ pub struct Polygon {
impl Polygon {
pub fn update(&mut self, path_of_project: &str) {
let path = format!("{0}", &self.sound_name);
self.sound = StaticSoundData::from_file(format!("{0}/{1}", path_of_project, path))
.expect("fail to load the sound");
dbg!(path.clone());
self.sound = if path == String::from("Default_Sound.ogg") {
StaticSoundData::from_file("assets/Default_Sound.ogg").expect("fail to load the sound")
} else {
StaticSoundData::from_file(format!("{0}/{1}", path_of_project, path))
.expect("fail to load the sound")
}
}
pub fn sound_to_play_btw(&self, before: f32, after: f32) -> Vec<&StaticSoundData> {
let mut sound_to_play: Vec<&StaticSoundData> = vec![];
@@ -369,5 +373,5 @@ impl Polygon {
}
}
fn dummy_sound() -> StaticSoundData {
StaticSoundData::from_file("assets/tick.ogg").expect("Fail to load audio")
StaticSoundData::from_file("assets/Default_Sound.ogg").expect("Fail to load audio")
}