pub fn fill() -> Self {
        let mut map: HashMap<&str, Sound> = HashMap::new();
        // iterate over all soundfiles
        for path in SOUNDS {
            // Find the Sound-folder in directory
            if let Ok(sound_path) = find_folder::Search::ParentsThenKids(2, 2)
                .for_folder("Sounds") {
                // Create path with found folder-path and sound name
                let s_path = sound_path.join(path);
                // Create String from path
                if let Some(sound_string) = s_path.to_str() {
                    // Open path and create Sound
                    if let Some(sound) = Sound::new(sound_string) {
                        // insert sound
                        map.insert(path, sound);

                    } else {
                        println!("Unable to build Sound-file: {}", path);
                    }
                    // Insert Sound in HashMap
                } else {
                    println!("Unable to build Path to String: {}", path);
                }
            } else {
                println!("File: {} not found in: {}", path, "Sounds")
            }
        }
        SoundHandler { map: map }
    }
/// Fills the Soundhandler with Sounds given in const SOUNDS.
/// The Filename is the key and the ears::Sound is the value
Fills the Soundhandler with Sounds given in const SOUNDS.
The Filename is the key and the ears::Sound is the value
Fills the Soundhandler with Sounds given in const SOUNDS . The Filename is the key and the ears :: Sound is the value
pub fn fill() -> Self {
        let mut map: HashMap<&str, Sound> = HashMap::new();
        // iterate over all soundfiles
        for path in SOUNDS {
            // Find the Sound-folder in directory
            if let Ok(sound_path) = find_folder::Search::ParentsThenKids(2, 2)
                .for_folder("Sounds") {
                // Create path with found folder-path and sound name
                let s_path = sound_path.join(path);
                // Create String from path
                if let Some(sound_string) = s_path.to_str() {
                    // Open path and create Sound
                    if let Some(sound) = Sound::new(sound_string) {
                        // insert sound
                        map.insert(path, sound);
                    } else {
                        println!("Unable to build Sound-file: {}", path);
                    }
                    // Insert Sound in HashMap
                } else {
                    println!("Unable to build Path to String: {}", path);
                }
            } else {
                println!("File: {} not found in: {}", path, "Sounds")
            }
        }
        SoundHandler { map: map }
    }
pub fn fill ( ) -> Self { let mut map : HashMap < & str , Sound > = HashMap :: new ( ) ; // iterate over all soundfiles for path in SOUNDS { // Find the Sound-folder in directory if let Ok ( sound_path ) = find_folder :: Search :: ParentsThenKids ( 2 , 2 ) . for_folder ( " " ) { // Create path with found folder-path and sound name let s_path = sound_path . join ( path ) ; // Create String from path if let Some ( sound_string ) = s_path . to_str ( ) { // Open path and create Sound if let Some ( sound ) = Sound :: new ( sound_string ) { // insert sound map . insert ( path , sound ) ; } else { println ! ( " " path ) ; } // Insert Sound in HashMap } else { println ! ( " " path ) ; } } else { println ! ( " " path " " ) } } SoundHandler { map : map } }
Fills the Soundhandler with Sounds given in const SOUNDS.
Fills the Soundhandler with Sounds given in const SOUNDS .