From 71825165d2fccfc2e0fc475fd97fe7e241cb4742 Mon Sep 17 00:00:00 2001 From: Alejandro Perea Date: Thu, 18 May 2023 20:59:53 +0200 Subject: [PATCH] Update version to 0.11.1 (#267) * Update version * Add load_tmx_map_from note * Fix copypasta * Fix indentation * Change version in README --- CHANGELOG.md | 38 +++++++++++++++++++++++++++++++++++--- Cargo.toml | 2 +- README.md | 2 +- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57234b5c..4c6ee6ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.11.1] ### Added -- WASM support + `wasm` feature; Check `README.md` for instructions on how to set it up. -- Support for staggered maps. Maps now have an `stagger_axis` and `stagger_index` property. +- WASM support + `wasm` feature; Check `README.md` for instructions on how to set it up. (#252) +- Support for staggered maps. Maps now have an `stagger_axis` and `stagger_index` property. (#262) ## [0.11.0] ### Added @@ -30,6 +30,38 @@ objects. As such, `ResourceCache` has now methods for both getting and inserting ### Removed - `ObjectData::obj_type`, `ObjectData::width`, `ObjectData::height`. (#253) - `TileData::tile_type` (which has been renamed to `TileData::user_type`) (#253) +- `Loader::load_tmx_map_from`, `Loader::load_tsx_tileset_from`: This was a hacky solution to loading embedded maps and tilesets. While there is no direct, ready-to-use replacement for this within the crate, you can create a `ResourceReader` that works like this function previously did: +```rs +struct EmbeddedResourceReader { + reader: Option, +} + +impl EmbeddedResourceReader { + fn new(reader: R) -> Self { + Self { + reader: Some(reader), + } + } +} + +impl tiled::ResourceReader for EmbeddedResourceReader { + type Resource = R; + type Error = std::io::Error; + + fn read_from(&mut self, path: &Path) -> std::result::Result { + if path == "the_path_to_load.tmx" { + if let Some(x) = self.reader.take() { + Ok(x) + } else { + Err(std::io::Error::from(ErrorKind::ResourceBusy)) + } + } else { + Err(std::io::Error::from(ErrorKind::NotFound)) + } + } +} +``` +Note: This works for both maps and tilesets, and you can extend to use more than one reader if neccessary, which is something you couldn't do before. ## [0.10.3] ### Added diff --git a/Cargo.toml b/Cargo.toml index 151edb53..dbdec480 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tiled" -version = "0.11.0" +version = "0.11.1" description = "A rust crate for loading maps created by the Tiled editor" categories = ["game-development"] keywords = ["gamedev", "tiled", "tmx", "map"] diff --git a/README.md b/README.md index d9a7db75..aaf3464f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # rs-tiled ```toml -tiled = "0.11.0" +tiled = "0.11.1" ``` [![Rust](https://github.com/mapeditor/rs-tiled/actions/workflows/rust.yml/badge.svg)](https://github.com/mapeditor/rs-tiled/actions/workflows/rust.yml)