diff options
| -rw-r--r-- | Cargo.lock | 205 | ||||
| -rw-r--r-- | Cargo.toml | 17 | ||||
| -rw-r--r-- | dungeon/src/map.rs | 5 | ||||
| -rw-r--r-- | game/Cargo.toml | 2 | ||||
| -rw-r--r-- | game/src/main.rs | 15 |
5 files changed, 49 insertions, 195 deletions
@@ -12,54 +12,33 @@ dependencies = [ ] [[package]] -name = "anstream" -version = "0.6.21" +name = "argh" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +checksum = "34ff18325c8a36b82f992e533ece1ec9f9a9db446bd1c14d4f936bac88fcd240" dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "is_terminal_polyfill", - "utf8parse", + "argh_derive", + "argh_shared", + "rust-fuzzy-search", ] [[package]] -name = "anstyle" -version = "1.0.13" +name = "argh_derive" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" - -[[package]] -name = "anstyle-parse" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +checksum = "adb7b2b83a50d329d5d8ccc620f5c7064028828538bdf5646acd60dc1f767803" dependencies = [ - "utf8parse", + "argh_shared", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "anstyle-query" -version = "1.1.4" +name = "argh_shared" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "anstyle-wincon" -version = "3.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" -dependencies = [ - "anstyle", - "once_cell_polyfill", - "windows-sys", -] +checksum = "a464143cc82dedcdc3928737445362466b7674b5db4e2eb8e869846d6d84f4f6" [[package]] name = "bindgen" @@ -126,46 +105,6 @@ dependencies = [ ] [[package]] -name = "clap" -version = "4.5.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5" -dependencies = [ - "clap_builder", - "clap_derive", -] - -[[package]] -name = "clap_builder" -version = "4.5.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.5.49" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" - -[[package]] name = "cmake" version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -175,12 +114,6 @@ dependencies = [ ] [[package]] -name = "colorchoice" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" - -[[package]] name = "dungeon" version = "0.1.0" dependencies = [ @@ -205,7 +138,7 @@ checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127" name = "game" version = "0.1.0" dependencies = [ - "clap", + "argh", "dungeon", "graphics", ] @@ -252,12 +185,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "is_terminal_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" - -[[package]] name = "itertools" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -327,12 +254,6 @@ dependencies = [ ] [[package]] -name = "once_cell_polyfill" -version = "1.70.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" - -[[package]] name = "paste" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -463,6 +384,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] +name = "rust-fuzzy-search" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a157657054ffe556d8858504af8a672a054a6e0bd9e8ee531059100c0fa11bb2" + +[[package]] name = "rustc-hash" version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -481,12 +408,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] name = "strum" version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -542,12 +463,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] -name = "utf8parse" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" - -[[package]] name = "wasip2" version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -563,80 +478,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] -name = "windows-sys" -version = "0.60.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.53.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" -dependencies = [ - "windows-link", - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" - -[[package]] -name = "windows_i686_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" - -[[package]] -name = "windows_i686_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.53.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" - -[[package]] name = "wit-bindgen" version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -16,14 +16,21 @@ publish = false rust-version = "1.87" [workspace.dependencies] -clap = { version = "4", features = ["derive"] } dungeon = { path = "dungeon" } game = { path = "game" } graphics = { path = "graphics" } -rand = "0.9" -strum = "0.27" strum_macros = "0.27" +[workspace.dependencies.argh] +version = "0.1" +default-features = false +features = ["help"] + +[workspace.dependencies.rand] +version = "0.9" +default-features = false +features = ["std_rng", "os_rng"] + [workspace.dependencies.raylib] git = "https://github.com/raylib-rs/raylib-rs" version = "5.7.0" @@ -38,6 +45,10 @@ features = [ "SUPPORT_TRACELOG", ] +[workspace.dependencies.strum] +version = "0.27" +default-features = false + [workspace.lints.clippy] # nursery branches_sharing_code = "warn" diff --git a/dungeon/src/map.rs b/dungeon/src/map.rs index fef0750..19c1de8 100644 --- a/dungeon/src/map.rs +++ b/dungeon/src/map.rs @@ -1,7 +1,7 @@ //! The `map` module contains structures of the dungeon game map //! including the current `Floor`, and map `Tile`. -use rand::{Rng, SeedableRng, rngs::StdRng}; +use rand::{rngs::StdRng, Rng, SeedableRng, TryRngCore}; use strum::IntoEnumIterator; use strum_macros::EnumIter; @@ -116,7 +116,8 @@ impl Floor { /// ``` #[must_use] pub fn generate() -> Self { - let seed = rand::random(); + let mut rng = rand::rngs::OsRng; + let seed = rng.try_next_u64().unwrap_or(0); Self::generate_seeded(seed) } diff --git a/game/Cargo.toml b/game/Cargo.toml index b42d1c1..7b5668e 100644 --- a/game/Cargo.toml +++ b/game/Cargo.toml @@ -8,7 +8,7 @@ publish.workspace = true rust-version.workspace = true [dependencies] -clap.workspace = true +argh.workspace = true dungeon.workspace = true graphics.workspace = true diff --git a/game/src/main.rs b/game/src/main.rs index 53d17b7..6905fe3 100644 --- a/game/src/main.rs +++ b/game/src/main.rs @@ -1,4 +1,4 @@ -use clap::Parser; +use argh::FromArgs; use dungeon::*; use graphics::*; @@ -76,19 +76,20 @@ impl Game { } } -#[derive(Parser)] +/// Play a dungeon crawl game +#[derive(FromArgs)] struct Args { - /// Enable vsync - #[arg(long)] + /// enable vsync + #[argh(switch)] vsync: bool, - // Enable verbose logging - #[arg(short, long)] + /// enable verbose logging + #[argh(switch, short = 'v')] verbose: bool, } fn main() -> Result<()> { // Parse arguments - let args = Args::parse(); + let args: Args = argh::from_env(); // Load the window let window = WindowBuilder::new() .vsync(args.vsync) |