Skip to content

Commit

Permalink
Update bitflags and rust edition (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
feelingsonice authored Mar 14, 2024
1 parent ba9f5ba commit 1958102
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
17 changes: 7 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@
name = "asefile"
version = "0.3.7"
authors = ["alpine-alpaca <[email protected]>"]
edition = "2018"
edition = "2021"
license = "MIT"
description = "Utilities for loading Aseprite files."
homepage = "https://github.com/alpine-alpaca/asefile"
repository = "https://github.com/alpine-alpaca/asefile"
readme = "README.md"
keywords = ["gamedev", "aseprite", "pixel", "2D"]
categories = ["game-development", "multimedia::images", "rendering::data-formats"]
include = [
"Cargo.toml",
"README.md",
"CHANGELOG.md",
"LICENSE",
"src/*"
categories = [
"game-development",
"multimedia::images",
"rendering::data-formats",
]
include = ["Cargo.toml", "README.md", "CHANGELOG.md", "LICENSE", "src/*"]

rust-version = "1.51"

[package.metadata.docs.rs]
all-features = true
Expand All @@ -36,7 +33,7 @@ utils = []
byteorder = "1.3"
log = "0.4"
flate2 = "1.0"
bitflags = "1.2"
bitflags = "2.4"
nohash = "0.2"
image = { version = "0.24", default-features = false }

Expand Down
3 changes: 2 additions & 1 deletion src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bitflags! {
///
/// For checking whether a layer is visible prefer to use [Layer::is_visible]
/// as that also takes into account any parent layer's visibility.
#[derive(Debug, Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
pub struct LayerFlags: u32 {
/// Layer is visible (eye icon is enabled).
const VISIBLE = 0x0001;
Expand All @@ -44,7 +45,7 @@ bitflags! {
const REFERENCE = 0x0040;

/// The is a background layer.
const BACKGROUND_LAYER = Self::MOVEMENT_LOCKED.bits | Self::BACKGROUND.bits;
const BACKGROUND_LAYER = Self::MOVEMENT_LOCKED.bits() | Self::BACKGROUND.bits();
}
}

Expand Down
5 changes: 4 additions & 1 deletion src/tileset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,10 @@ impl Tileset<RawPixels> {
) -> Result<Tileset<RawPixels>> {
let mut reader = AseReader::new(data);
let id = reader.dword()?;
let flags = reader.dword().map(|val| TilesetFlags { bits: val })?;
let flags = reader
.dword()
.map(TilesetFlags::from_bits)?
.unwrap_or(TilesetFlags::EMPTY_TILE_IS_ID_ZERO);
let empty_tile_is_id_zero = flags.contains(TilesetFlags::EMPTY_TILE_IS_ID_ZERO);
let tile_count = reader.dword()?;
let tile_width = reader.word()?;
Expand Down

0 comments on commit 1958102

Please sign in to comment.