pub fn load_from_path(&mut self, path: PathBuf) {
        self.tileset = tileset::TileSet::load_from_path(path.clone());

        // Collect the fonts

        let font_path = path.join("assets").join("fonts");
        let paths = std::fs::read_dir(font_path).unwrap();

        for path in paths {
            // Generate the tile map for this dir element
            let path = &path.unwrap().path();

            if path.is_file() {//&& path.extension().map(|s| s == "ttf").unwrap_or(false) {

                if let Some(font_bytes) = std::fs::read(path).ok() {
                if let Some(font) = Font::from_bytes(font_bytes, fontdue::FontSettings::default()).ok() {
                        self.game_fonts.insert(path.file_stem().unwrap().to_os_string().into_string().unwrap(), font);
                    }
                }
            }
        }
    }
/// Load the tilemaps from the given path
Load the tilemaps from the given path
Load the tilemaps from the given path
pub fn load_from_path(&mut self, path: PathBuf) {
        self.tileset = tileset::TileSet::load_from_path(path.clone());
        // Collect the fonts
        let font_path = path.join("assets").join("fonts");
        let paths = std::fs::read_dir(font_path).unwrap();
        for path in paths {
            // Generate the tile map for this dir element
            let path = &path.unwrap().path();
            if path.is_file() {//&& path.extension().map(|s| s == "ttf").unwrap_or(false) {
                if let Some(font_bytes) = std::fs::read(path).ok() {
                if let Some(font) = Font::from_bytes(font_bytes, fontdue::FontSettings::default()).ok() {
                        self.game_fonts.insert(path.file_stem().unwrap().to_os_string().into_string().unwrap(), font);
                    }
                }
            }
        }
    }
pub fn load_from_path ( & mut self , path : PathBuf ) { self . tileset = tileset :: TileSet :: load_from_path ( path . clone ( ) ) ; // Collect the fonts let font_path = path . join ( " " ) . join ( " " ) ; let paths = std :: fs :: read_dir ( font_path ) . unwrap ( ) ; for path in paths { // Generate the tile map for this dir element let path = & path . unwrap ( ) . path ( ) ; if path . is_file ( ) { //&& path.extension().map(|s| s == "ttf").unwrap_or(false) { if let Some ( font_bytes ) = std :: fs :: read ( path ) . ok ( ) { if let Some ( font ) = Font :: from_bytes ( font_bytes , fontdue :: FontSettings :: default ( ) ) . ok ( ) { self . game_fonts . insert ( path . file_stem ( ) . unwrap ( ) . to_os_string ( ) . into_string ( ) . unwrap ( ) , font ) ; } } } } }
Load the tilemaps from the given path
Load the tilemaps from the given path
&mut self
path
PathBuf
&mut self
path
PathBuf