Skip to content

Commit

Permalink
dir stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeWaka committed Dec 24, 2023
1 parent aa565fe commit 0b2a694
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ exclude = ["src/tests.rs", "tests/*"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
thiserror = "1.0"
image = { version = "0.24.7", default-features = false, features = ["png"] }
bitflags = "2.4.1"
deflate = "1.0"
image = { version = "0.24.7", default-features = false, features = ["png"] }
inflate = "0.4.5"
thiserror = "1.0"
37 changes: 37 additions & 0 deletions src/dirs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use bitflags::bitflags;

bitflags! {
pub struct Dirs: u8 {
const NORTH = 1 << 1;
const SOUTH = 1 << 2;
const EAST = 1 << 3;
const WEST = 1 << 4;
const SOUTHEAST = Self::SOUTH.bits() | Self::EAST.bits();
const SOUTHWEST = Self::SOUTH.bits() | Self::WEST.bits();
const NORTHEAST = Self::NORTH.bits() | Self::EAST.bits();
const NORTHWEST = Self::NORTH.bits() | Self::WEST.bits();
}
}

/// A list of every cardinal direction.
pub const CARDINAL_DIRS: [Dirs; 4] = [Dirs::NORTH, Dirs::SOUTH, Dirs::EAST, Dirs::WEST];

/// A list of every ordinal direction.
pub const ORDINAL_DIRS: [Dirs; 4] = [
Dirs::NORTHEAST,
Dirs::NORTHWEST,
Dirs::SOUTHEAST,
Dirs::SOUTHWEST,
];

/// A list of every direction, cardinals and ordinals.
pub const ALL_DIRS: [Dirs; 8] = [
Dirs::NORTH,
Dirs::SOUTH,
Dirs::EAST,
Dirs::WEST,
Dirs::NORTHEAST,
Dirs::NORTHWEST,
Dirs::SOUTHEAST,
Dirs::SOUTHWEST,
];
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pub mod chunk;
pub(crate) mod crc;
pub mod dirs;
pub mod error;
pub mod icon;
pub mod iend;
Expand Down

0 comments on commit 0b2a694

Please sign in to comment.