diff --git a/Cargo.lock b/Cargo.lock index 3c2594f..94246dd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -181,7 +190,7 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "ddnet-map-gen" -version = "0.2.2" +version = "0.2.3" dependencies = [ "clap", "color-eyre", @@ -196,6 +205,7 @@ dependencies = [ "rand_distr", "rand_seeder", "twmap", + "vek", ] [[package]] @@ -244,6 +254,7 @@ dependencies = [ "az", "bytemuck", "half", + "num-traits", "serde", "typenum", ] @@ -677,6 +688,15 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.36.9" @@ -707,6 +727,12 @@ dependencies = [ "regex", ] +[[package]] +name = "semver" +version = "1.0.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" + [[package]] name = "serde" version = "1.0.154" @@ -868,10 +894,11 @@ dependencies = [ [[package]] name = "twmap" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d22e0085b0a65f399fcac949306194f0217c06aa2217b9e19a01944d162851" +checksum = "e572d31d0ba97c8509edd1956d4828cd8c7b5139a7192d7d7865517cddd3aeee" dependencies = [ + "az", "bitflags", "bytemuck", "fixed", @@ -886,6 +913,7 @@ dependencies = [ "serde_json", "structview", "thiserror", + "vek", ] [[package]] @@ -912,6 +940,20 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "vek" +version = "0.15.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8085882662f9bc47fc8b0cdafa5e19df8f592f650c02b9083da8d45ac9eebd17" +dependencies = [ + "approx", + "az", + "num-integer", + "num-traits", + "rustc_version", + "serde", +] + [[package]] name = "version_check" version = "0.9.4" diff --git a/Cargo.toml b/Cargo.toml index 0ee5681..cfc750d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "ddnet-map-gen" authors = ["Edgar "] description = "A DDraceNetwork map generator." -version = "0.2.2" +version = "0.2.3" edition = "2021" license = "AGPL-3.0-only" repository = "https://github.com/edg-l/ddnet-map-gen" @@ -24,4 +24,5 @@ rand = "0.8.5" rand_chacha = "0.3.1" rand_distr = "0.4.3" rand_seeder = "0.2.3" -twmap = "0.9.1" +twmap = "0.10.0" +vek = "0.15.10" diff --git a/src/generators/fly.rs b/src/generators/fly.rs index 915a95b..962ec2f 100644 --- a/src/generators/fly.rs +++ b/src/generators/fly.rs @@ -101,12 +101,7 @@ impl MapGenerator for FlyGenerator { let mut freeze_tiles_layer = TilesLayer::new((height, width)); freeze_tiles_layer.image = Some(1); freeze_tiles_layer.tiles = CompressedData::Loaded(freeze_tiles); - freeze_tiles_layer.color = Color { - r: 0, - g: 0, - b: 0, - a: 200, - }; + freeze_tiles_layer.color = Rgba::new(0, 0, 0, 200); let mut physics = Group::physics(); physics.layers.push(Layer::Game(game_layer)); diff --git a/src/generators/mod.rs b/src/generators/mod.rs index 7347d00..f1b9d96 100644 --- a/src/generators/mod.rs +++ b/src/generators/mod.rs @@ -6,6 +6,7 @@ use fixed::types::I17F15; use ndarray::Array2; use rand::Rng; use twmap::*; +use vek::{Extent2, Rgba}; pub mod fly; pub mod maze; @@ -49,7 +50,7 @@ pub fn create_initial_map(mapres: &Path) -> Result { //map.info.version = map.images.push(Image::External(ExternalImage { name: "generic_unhookable".to_string(), - size: Point::new_same(1024), + size: Extent2::new(1024, 1024), })); map.images.push(Image::Embedded(EmbeddedImage::from_file(mapres.join("basic_freeze.png")).note("Might have failed due to a non existing mapres directory, check out the '--mapres' option.")?)); Ok(map) @@ -64,34 +65,14 @@ pub fn quads_sky() -> Group { let mut quad = Quad::new( Default::default(), - Point::new(I17F15::from_num(50), I17F15::from_num(30)), + Extent2::new(I17F15::from_num(50), I17F15::from_num(30)), ) .unwrap(); quad.colors = [ - Color { - r: 94, - g: 132, - b: 174, - a: 255, - }, - Color { - r: 94, - g: 132, - b: 174, - a: 255, - }, - Color { - r: 204, - g: 232, - b: 255, - a: 255, - }, - Color { - r: 204, - g: 232, - b: 255, - a: 255, - }, + Rgba::new(94, 132, 174, 255), + Rgba::new(94, 132, 174, 255), + Rgba::new(204, 232, 255, 255), + Rgba::new(204, 232, 255, 255), ]; quads_layer.quads.push(quad);