diff options
| -rw-r--r-- | Cargo.lock | 68 | ||||
| -rw-r--r-- | Cargo.toml | 27 | ||||
| -rw-r--r-- | flake.nix | 1 | ||||
| -rw-r--r-- | graphics/src/lib.rs | 1 | ||||
| -rw-r--r-- | graphics/src/render.rs | 27 |
5 files changed, 83 insertions, 41 deletions
@@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.70.1" +version = "0.71.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" dependencies = [ "bitflags", "cexpr", @@ -39,11 +39,13 @@ checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "cc" -version = "1.2.43" +version = "1.2.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "739eb0f94557554b3ca9a86d2d37bebd49c5e6d0c1d2bda35ba5bdac830befc2" +checksum = "35900b6c8d709fb1d854671ae27aeaa9eec2f8b01b364e1619a40da3e6fe2afe" dependencies = [ "find-msvc-tools", + "jobserver", + "libc", "shlex", ] @@ -124,6 +126,15 @@ dependencies = [ ] [[package]] +name = "glam" +version = "0.30.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd47b05dddf0005d850e5644cae7f2b14ac3df487979dbfff3b56f20b1a6ae46" +dependencies = [ + "mint", +] + +[[package]] name = "glob" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -153,6 +164,16 @@ dependencies = [ ] [[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom", + "libc", +] + +[[package]] name = "libc" version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -187,6 +208,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] +name = "mint" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff" + +[[package]] name = "nom" version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -232,9 +259,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.41" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] @@ -276,11 +303,10 @@ dependencies = [ [[package]] name = "raylib" -version = "5.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c54335590d1b6e6fbdbccee09dafdfd76a1111fc3c709eca949e71e81f7a8a" +version = "5.7.0" +source = "git+https://github.com/raylib-rs/raylib-rs#0e8e899b36eb7db48306bbcd710570f955508040" dependencies = [ - "cfg-if", + "glam", "paste", "raylib-sys", "seq-macro", @@ -289,13 +315,13 @@ dependencies = [ [[package]] name = "raylib-sys" -version = "5.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ce5adc950b042db67f1f78f24f7e76563652ce24db032afe9ca9e534d8b7a13" +version = "5.7.0" +source = "git+https://github.com/raylib-rs/raylib-rs#0e8e899b36eb7db48306bbcd710570f955508040" dependencies = [ "bindgen", "cc", "cmake", + "mint", ] [[package]] @@ -329,9 +355,9 @@ checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "seq-macro" @@ -365,9 +391,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.108" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2", "quote", @@ -376,18 +402,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.69" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.69" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", @@ -20,10 +20,25 @@ dungeon = { path = "dungeon" } game = { path = "game" } graphics = { path = "graphics" } rand = "0.9" -raylib = "5.5" strum = "0.27" strum_macros = "0.27" +[workspace.dependencies.raylib] +git = "https://github.com/raylib-rs/raylib-rs" +version = "5.7.0" +default-features = false +features = [ + "GLFW_BUILD_X11", + "USE_AUDIO", + "SUPPORT_MODULE_RSHAPES", + "SUPPORT_MODULE_RTEXTURES", + "SUPPORT_MODULE_RTEXT", + "SUPPORT_MODULE_RAUDIO", + "SUPPORT_CAMERA_SYSTEM", + "SUPPORT_FILEFORMAT_BMP", + "SUPPORT_STANDARD_FILEIO", +] + [workspace.lints.clippy] # nursery branches_sharing_code = "warn" @@ -53,3 +68,13 @@ allow_attributes = "warn" expect_used = "deny" shadow_reuse = "warn" unwrap_used = "deny" + +[profile.release] +opt-level = 3 +lto = "fat" +codegen-units = 1 +panic = "abort" +strip = "symbols" +debug = false +incremental = false +overflow-checks = false @@ -43,6 +43,7 @@ rustfmt rust-analyzer cargo + cargo-flamegraph clippy # raylib cmake diff --git a/graphics/src/lib.rs b/graphics/src/lib.rs index 5c1161b..27e49d3 100644 --- a/graphics/src/lib.rs +++ b/graphics/src/lib.rs @@ -48,7 +48,6 @@ impl Window { .title(title) .resizable() .log_level(TraceLogLevel::LOG_WARNING) - .vsync() .build(); // update window min size diff --git a/graphics/src/render.rs b/graphics/src/render.rs index 8e5869a..1061af3 100644 --- a/graphics/src/render.rs +++ b/graphics/src/render.rs @@ -240,14 +240,7 @@ impl Renderer { RENDER_WIDTH as f32 * scale, RENDER_HEIGHT as f32 * scale, }; - r.draw_texture_pro( - &fb, - source_rec, - dest_rec, - Vector2::zero(), - 0.0, - Color::WHITE, - ); + r.draw_texture_pro(&fb, source_rec, dest_rec, Vector2::ZERO, 0.0, Color::WHITE); // Restore the fb self.framebuffer = Some(fb); @@ -604,7 +597,7 @@ impl Renderer { tex, FULL_SOURCE_REC, dest_rec, - Vector2::zero(), + Vector2::ZERO, 0.0, Color::WHITE, ); @@ -764,16 +757,14 @@ impl DungeonExt for Dungeon { } trait Vector2Ext { - fn min(self, other: Self) -> Self; - fn max(self, other: Self) -> Self; + fn scale_by(self, amt: f32) -> Self; } impl Vector2Ext for Vector2 { - fn min(self, other: Self) -> Self { - Self::new(self.x.min(other.x), self.y.min(other.y)) - } - - fn max(self, other: Self) -> Self { - Self::new(self.x.max(other.x), self.y.max(other.y)) + fn scale_by(self, amt: f32) -> Self { + Self { + x: self.x * amt, + y: self.y * amt, + } } } @@ -841,7 +832,7 @@ where width * scale, height * scale, }; - let origin = Vector2::zero(); + let origin = Vector2::ZERO; self.draw_texture_pro(tex, source_rec, dest_rec, origin, 0.0, Color::WHITE); } |