[][src]Function wfc_tiled::grid_to_tiled

pub fn grid_to_tiled<P: AsRef<Path>>(
    grid: &Grid<u32>,
    path: P,
    tileset: TileSet
) -> Result<(), Box<dyn Error>>

Save a Grid to a Tiled .tmx file.

This is meant for previewing the output of TilePattern::run_collapse() in Tiled, although generated tmx files can be edited normally in the application.

It is fairly limited in that it creates a file with only one layer, one tileset and no extra settings.

Examples

use wfc_tiled::grid_to_tiled;
let tset = TileSet {
    image_path: "examples\\tset.png", // tile set sprite sheet
    image_size: Size::new(256, 1450),
    columns: 8,
    tile_count: 360,
    tile_size: Size::new(32, 32)
};
grid_to_tiled(&grid, "output.tmx", tset)?;