Skip to content

Commit

Permalink
Merge branch 'current' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
aleokdev committed Feb 13, 2023
2 parents 15a0b4a + bf18441 commit 5300147
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ objects. As such, `ResourceCache` has now methods for both getting and inserting
- `ResourceCache::get_or_try_insert_tileset_with` has been replaced by `ResourceCache::insert_tileset`.
- `DefaultResourceCache`'s members have been made public.

## [Unreleased]
## [0.10.3]
### Added
- Support for Wang sets.
- Support for Tiled 1.9 `Class` property. Maps, tilesets and layers now have a `user_type` property.
- Support for tile offsets. Tilesets now have an `offset_x` and `offset_y` property.

### Deprecated
- `Tile::tile_type`: Use `Tile::user_type` instead.
- `Object::obj_type` Use `Object::user_type` instead.

### Changed
- Update `zstd` to `0.12.0`.
- Update `sfml` dev dependency to `0.19.0`.
- Update `sfml` dev dependency to `0.20.0`.
- Update `base64` to `0.21.0`.

## [0.10.2]
### Added
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ name = "ggez"
path = "examples/ggez/main.rs"

[dependencies]
base64 = "0.13.0"
base64 = "0.21.0"
xml-rs = "0.8.4"
libflate = "1.1.2"
zstd = { version = "0.12.0", optional = true }

[dev-dependencies.sfml]
version = "0.19.0"
version = "0.20.0"
features = ["graphics"]

[dev-dependencies.ggez]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ tiled = "0.11.0"

[![Rust](https://github.com/mapeditor/rs-tiled/actions/workflows/rust.yml/badge.svg)](https://github.com/mapeditor/rs-tiled/actions/workflows/rust.yml)
[![Crates.io](https://img.shields.io/crates/v/tiled.svg)](https://crates.io/crates/tiled)
[![dependency status](https://deps.rs/crate/tiled/0.10.2/status.svg)](https://deps.rs/crate/tiled/0.10.2)
[![dependency status](https://deps.rs/crate/tiled/latest/status.svg)](https://deps.rs/crate/tiled)

A crate for reading TMX (map) and TSX (tileset) files from the [Tiled Map Editor](http://www.mapeditor.org/) into Rust.
It provides a huge set of features as well as a strong wrapper over internal features such as GIDs.
Expand Down
2 changes: 1 addition & 1 deletion src/layers/tile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl LayerTileData {
| Self::FLIPPED_VERTICALLY_FLAG
| Self::FLIPPED_DIAGONALLY_FLAG;

/// Creates a new [`LayerTileData`] from a [`GID`] plus its flipping bits.
/// Creates a new [`LayerTileData`] from a [`Gid`] plus its flipping bits.
pub(crate) fn from_bits(bits: u32, tilesets: &[MapTilesetGid]) -> Option<Self> {
let flags = bits & Self::ALL_FLIP_FLAGS;
let gid = Gid(bits & !Self::ALL_FLIP_FLAGS);
Expand Down
8 changes: 7 additions & 1 deletion src/layers/tile/util.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{convert::TryInto, io::Read};

use base64::Engine;
use xml::reader::XmlEvent;

use crate::{util::XmlEventResult, Error, LayerTileData, MapTilesetGid, Result};
Expand Down Expand Up @@ -36,7 +37,12 @@ fn parse_base64(parser: &mut impl Iterator<Item = XmlEventResult>) -> Result<Vec
for next in parser {
match next.map_err(Error::XmlDecodingError)? {
XmlEvent::Characters(s) => {
return base64::decode(s.trim().as_bytes()).map_err(Error::Base64DecodingError)
return base64::engine::GeneralPurpose::new(
&base64::alphabet::STANDARD,
base64::engine::general_purpose::PAD,
)
.decode(s.trim().as_bytes())
.map_err(Error::Base64DecodingError)
}
XmlEvent::EndElement { name, .. } if name.local_name == "data" => {
return Ok(Vec::new());
Expand Down
2 changes: 1 addition & 1 deletion src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ impl fmt::Display for Orientation {
/// Tiled also treats GID 0 as empty space, which means that the first tileset in the map will have
/// a starting GID of 1.
///
/// See also: https://doc.mapeditor.org/en/latest/reference/global-tile-ids/
/// See also: <https://doc.mapeditor.org/en/latest/reference/global-tile-ids/>
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub(crate) struct Gid(pub u32);

Expand Down
8 changes: 3 additions & 5 deletions src/tile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ pub struct TileData {
/// The animation frames of this tile.
pub animation: Option<Vec<Frame>>,
/// The type of this tile.
pub user_type: Option<String>,
/// This property has been renamed to `user_type`.
#[deprecated(since = "0.10.3", note = "Use [`TileData::user_type`] instead")]
// TODO(0.11.0): Rename to `user_type` (https://github.com/mapeditor/rs-tiled/pull/238, postponed because of
// breaking change)
pub tile_type: Option<String>,
/// The probability of this tile.
pub probability: f32,
Expand Down Expand Up @@ -112,8 +111,7 @@ impl TileData {
properties,
collision: objectgroup,
animation,
tile_type: user_type.clone(),
user_type,
tile_type: user_type,
probability: probability.unwrap_or(1.0),
},
))
Expand Down

0 comments on commit 5300147

Please sign in to comment.