pub fn from_layout(path_to_layout: String) -> Result<Self, EngineError> {
        // Load the layout file
        let filepath = path::PathBuf::from(&path_to_layout);
        let layout_string = std::fs::read_to_string(&filepath)?; 

        // Find the image's path
        let mut img_path = filepath.clone();
        img_path.set_extension("png");
        let img_path_str = img_path.to_string_lossy().to_string();
        
        // Parse the layout_string
        SpriteSheet::from_string(layout_string, img_path_str)
    }
/// Takes a path to a sprite sheet layout file and deserializes it into a SpriteSheet.
///
/// The layout file should be saved alongside the spritesheet image. It should be in Rusty 
/// Object Notation. An example can be found in SpriteSheet::from_string().
///
/// Note: the max sheet resolution is 255 tiles x 255 tiles
Takes a path to a sprite sheet layout file and deserializes it into a SpriteSheet.
The layout file should be saved alongside the spritesheet image. It should be in Rusty
Object Notation. An example can be found in SpriteSheet::from_string().

the max sheet resolution is 255 tiles x 255 tiles
Takes a path to a sprite sheet layout file and deserializes it into a SpriteSheet . The layout file should be saved alongside the spritesheet image . It should be in Rusty Object Notation . An example can be found in SpriteSheet :: from_string () . the max sheet resolution is 255 tiles x 255 tiles
pub fn from_layout(path_to_layout: String) -> Result<Self, EngineError> {
        // Load the layout file
        let filepath = path::PathBuf::from(&path_to_layout);
        let layout_string = std::fs::read_to_string(&filepath)?; 
        // Find the image's path
        let mut img_path = filepath.clone();
        img_path.set_extension("png");
        let img_path_str = img_path.to_string_lossy().to_string();
        // Parse the layout_string
        SpriteSheet::from_string(layout_string, img_path_str)
    }
pub fn from_layout ( path_to_layout : String ) -> Result < Self , EngineError > { // Load the layout file let filepath = path :: PathBuf :: from ( & path_to_layout ) ; let layout_string = std :: fs :: read_to_string ( & filepath ) ? ; // Find the image's path let mut img_path = filepath . clone ( ) ; img_path . set_extension ( " " ) ; let img_path_str = img_path . to_string_lossy ( ) . to_string ( ) ; // Parse the layout_string SpriteSheet :: from_string ( layout_string , img_path_str ) }
Takes a path to a sprite sheet layout file and deserializes it into a SpriteSheet.
Takes a path to a sprite sheet layout file and deserializes it into a SpriteSheet .
path_to_layout
String
path_to_layout
String