diff --git a/.envrc b/.envrc index 3550a30..a7d4a4f 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use flake +# use flake diff --git a/.gitignore b/.gitignore index 02d6403..1fd999c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,13 @@ .direnv +# Added by cargo +# +# already existing elements were commented out + +#/target + + # Added by cargo # # already existing elements were commented out diff --git a/Cargo.lock b/Cargo.lock index 400954b..e9ae658 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,65 +10,21 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ - "getrandom", + "cfg-if", "once_cell", "version_check", -] - -[[package]] -name = "aho-corasick" -version = "0.7.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" -dependencies = [ - "memchr", -] - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", + "zerocopy", ] [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "ash" -version = "0.37.1+1.3.235" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "911015c962d56e2e4052f40182ca5462ba60a3d2ff04e827c365a0ab3d65726d" -dependencies = [ - "libloading", -] +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "autocfg" @@ -76,31 +32,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "base64" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -dependencies = [ - "byteorder", - "safemem", -] - -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - [[package]] name = "bitflags" version = "1.3.2" @@ -108,58 +39,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] -name = "block" -version = "0.1.6" +name = "block-buffer" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytemuck" -version = "1.12.3" +version = "1.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f" +checksum = "ed2490600f404f2b94c167e31d3ed1d5f3c225a0f3b80230053b3e0b7b962bd9" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "calloop" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a59225be45a478d772ce015d9743e49e92798ece9e34eda9a6aa2a6a7f40192" -dependencies = [ - "log", - "nix 0.25.1", - "slotmap", - "thiserror", - "vec_map", -] - -[[package]] -name = "cargo-run-wasm" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13b0eb1208f33599c1fea41f2f6a09bb7e27341acb79aa92e6d6847cc60a1828" -dependencies = [ - "devserver_lib", - "pico-args", - "wasm-bindgen-cli-support", -] - -[[package]] -name = "cc" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cfg-if" @@ -168,131 +72,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "cfg_aliases" -version = "0.1.1" +name = "color_quant" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" +checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] -name = "cmake" -version = "0.1.49" +name = "cpufeatures" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ - "cc", -] - -[[package]] -name = "cocoa" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" -dependencies = [ - "bitflags", - "block", - "cocoa-foundation", - "core-foundation", - "core-graphics", - "foreign-types 0.3.2", - "libc", - "objc", -] - -[[package]] -name = "cocoa-foundation" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" -dependencies = [ - "bitflags", - "block", - "core-foundation", - "core-graphics-types", - "foreign-types 0.3.2", - "libc", - "objc", -] - -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "console_log" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" -dependencies = [ - "log", - "web-sys", -] - -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" - -[[package]] -name = "core-graphics" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" -dependencies = [ - "bitflags", - "core-foundation", - "core-graphics-types", - "foreign-types 0.3.2", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" -dependencies = [ - "bitflags", - "core-foundation", - "foreign-types 0.3.2", - "libc", -] - -[[package]] -name = "core-text" -version = "19.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" -dependencies = [ - "core-foundation", - "core-graphics", - "foreign-types 0.3.2", "libc", ] @@ -306,504 +96,136 @@ dependencies = [ ] [[package]] -name = "crossfont" -version = "0.5.1" +name = "crypto-common" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21fd3add36ea31aba1520aa5288714dd63be506106753226d0eb387a93bc9c45" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "cocoa", - "core-foundation", - "core-foundation-sys", - "core-graphics", - "core-text", - "dwrote", - "foreign-types 0.5.0", - "freetype-rs", - "libc", - "log", - "objc", - "once_cell", - "pkg-config", - "servo-fontconfig", - "winapi", + "generic-array", + "typenum", ] [[package]] -name = "cty" -version = "0.2.2" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" - -[[package]] -name = "d3d12" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827914e1f53b1e0e025ecd3d967a7836b7bcb54520f90e21ef8df7b4d88a2759" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "bitflags", - "libloading", - "winapi", + "block-buffer", + "crypto-common", ] [[package]] -name = "darling" -version = "0.13.4" +name = "fdeflate" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "devserver_lib" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb4b71acc1405be2431a93892a79a0d82ed5ba6885649ddbdfc62caa4d67b1c" - -[[package]] -name = "dispatch" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" - -[[package]] -name = "dlib" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" -dependencies = [ - "libloading", -] - -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - -[[package]] -name = "dwrote" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" -dependencies = [ - "lazy_static", - "libc", - "serde", - "serde_derive", - "winapi", - "wio", -] - -[[package]] -name = "env_logger" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - -[[package]] -name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "expat-sys" -version = "2.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa" -dependencies = [ - "cmake", - "pkg-config", -] - -[[package]] -name = "fastrand" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" -dependencies = [ - "instant", + "simd-adler32", ] [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", ] [[package]] -name = "fnv" -version = "1.0.7" +name = "fontdue" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +checksum = "0793f5137567643cf65ea42043a538804ff0fbf288649e2141442b602d81f9bc" dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8469d0d40519bc608ec6863f1cc88f3f1deee15913f2f3b3e573d81ed38cccc" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - -[[package]] -name = "freetype-rs" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb" -dependencies = [ - "bitflags", - "freetype-sys", - "libc", -] - -[[package]] -name = "freetype-sys" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a" -dependencies = [ - "cmake", - "libc", - "pkg-config", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "getrandom" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "glow" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" -dependencies = [ - "js-sys", - "slotmap", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gpu-alloc" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc59e5f710e310e76e6707f86c561dd646f69a8876da9131703b2f717de818d" -dependencies = [ - "bitflags", - "gpu-alloc-types", -] - -[[package]] -name = "gpu-alloc-types" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" -dependencies = [ - "bitflags", -] - -[[package]] -name = "gpu-descriptor" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" -dependencies = [ - "bitflags", - "gpu-descriptor-types", "hashbrown", + "ttf-parser", ] [[package]] -name = "gpu-descriptor-types" -version = "0.1.1" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "bitflags", + "typenum", + "version_check", ] +[[package]] +name = "glam" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "518faa5064866338b013ff9b2350dc318e14cc4fcd6cb8206d7e7c9886c98815" + [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ "ahash", ] [[package]] -name = "heck" -version = "0.3.3" +name = "image" +version = "0.24.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +checksum = "034bbe799d1909622a74d1193aa50147769440040ff36cb2baa947609b0a4e23" dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hexf-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" - -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - -[[package]] -name = "id-arena" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" -dependencies = [ - "libc", - "windows-sys 0.42.0", -] - -[[package]] -name = "is-terminal" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" -dependencies = [ - "hermit-abi", - "io-lifetimes", - "rustix", - "windows-sys 0.42.0", + "bytemuck", + "byteorder", + "color_quant", + "num-traits", + "png", ] [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] -name = "jni-sys" -version = "0.3.0" +name = "json5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "js-sys" -version = "0.3.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" dependencies = [ - "wasm-bindgen", + "pest", + "pest_derive", + "serde", ] -[[package]] -name = "khronos-egl" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" -dependencies = [ - "libc", - "libloading", - "pkg-config", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "leb128" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" - [[package]] name = "libc" -version = "0.2.139" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] -name = "libloading" -version = "0.7.4" +name = "macroquad" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "a0bf249d79f5080e200334fe30ffca25582d682ee2e180768ad7f121ba9f8caa" dependencies = [ - "cfg-if", - "winapi", + "bumpalo", + "fontdue", + "glam", + "image", + "macroquad_macro", + "miniquad", + "quad-rand", + "slotmap", ] [[package]] -name = "linux-raw-sys" -version = "0.1.4" +name = "macroquad_macro" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" - -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "f5cecfede1e530599c8686f7f2d609489101d3d63741a6dc423afc997ce3fcc8" [[package]] name = "malloc_buf" @@ -816,212 +238,47 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] -name = "memmap2" -version = "0.5.8" +name = "miniquad" +version = "0.4.0-alpha.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" +checksum = "18742c400c9aa2d9b4ca72d366a38c9e2d896386e50c2e6d905b6028543a0a0b" dependencies = [ "libc", -] - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "metal" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060" -dependencies = [ - "bitflags", - "block", - "core-graphics-types", - "foreign-types 0.3.2", - "log", + "ndk-sys", "objc", + "winapi", ] -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", -] - -[[package]] -name = "mio" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.42.0", -] - -[[package]] -name = "naga" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262d2840e72dbe250e8cf2f522d080988dfca624c4112c096238a4845f591707" -dependencies = [ - "bit-set", - "bitflags", - "codespan-reporting", - "hexf-parse", - "indexmap", - "log", - "num-traits", - "rustc-hash", - "spirv", - "termcolor", - "thiserror", - "unicode-xid", -] - -[[package]] -name = "ndk" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" -dependencies = [ - "bitflags", - "jni-sys", - "ndk-sys", - "num_enum", - "raw-window-handle 0.5.0", - "thiserror", -] - -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - -[[package]] -name = "ndk-glue" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" -dependencies = [ - "libc", - "log", - "ndk", - "ndk-context", - "ndk-macro", - "ndk-sys", - "once_cell", - "parking_lot", -] - -[[package]] -name = "ndk-macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" -dependencies = [ - "darling", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", + "simd-adler32", ] [[package]] name = "ndk-sys" -version = "0.4.1+23.1.7779620" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" -dependencies = [ - "jni-sys", -] - -[[package]] -name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags", - "cfg-if", - "libc", - "memoffset", -] - -[[package]] -name = "nix" -version = "0.25.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" -dependencies = [ - "autocfg", - "bitflags", - "cfg-if", - "libc", - "memoffset", -] - -[[package]] -name = "nom" -version = "7.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5507769c4919c998e69e49c839d9dc6e693ede4cc4290d6ad8b41d4f09c548c" -dependencies = [ - "memchr", - "minimal-lexical", -] +checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] -[[package]] -name = "num_enum" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "objc" version = "0.2.7" @@ -1029,272 +286,116 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" dependencies = [ "malloc_buf", - "objc_exception", -] - -[[package]] -name = "objc_exception" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" -dependencies = [ - "cc", ] [[package]] name = "once_cell" -version = "1.17.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] -name = "parking_lot" -version = "0.12.1" +name = "pest" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06" dependencies = [ - "lock_api", - "parking_lot_core", + "memchr", + "thiserror", + "ucd-trie", ] [[package]] -name = "parking_lot_core" -version = "0.9.5" +name = "pest_derive" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +checksum = "bcd6ab1236bbdb3a49027e920e693192ebfe8913f6d60e294de57463a493cfde" dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys 0.42.0", + "pest", + "pest_generator", ] [[package]] -name = "percent-encoding" -version = "2.2.0" +name = "pest_generator" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "2a31940305ffc96863a735bef7c7994a00b325a7138fdbc5bda0f1a0476d3275" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] [[package]] -name = "pico-args" -version = "0.5.0" +name = "pest_meta" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" - -[[package]] -name = "pkg-config" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "a7ff62f5259e53b78d1af898941cdcdccfae7385cf7d793a6e55de5d05bb4b7d" +dependencies = [ + "once_cell", + "pest", + "sha2", +] [[package]] name = "png" -version = "0.17.7" +version = "0.17.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638" +checksum = "1f6c3c3e617595665b8ea2ff95a86066be38fb121ff920a9c0eb282abcd1da5a" dependencies = [ "bitflags", "crc32fast", + "fdeflate", "flate2", "miniz_oxide", ] -[[package]] -name = "pollster" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7" - -[[package]] -name = "proc-macro-crate" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" -dependencies = [ - "once_cell", - "thiserror", - "toml", -] - [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] [[package]] -name = "profiling" -version = "1.0.7" +name = "quad-rand" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74605f360ce573babfe43964cbe520294dcb081afbf8c108fc6e23036b4da2df" +checksum = "658fa1faf7a4cc5f057c9ee5ef560f717ad9d8dc66d975267f709624d6e1ab88" [[package]] name = "quote" -version = "1.0.23" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] -[[package]] -name = "range-alloc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6" - -[[package]] -name = "raw-window-handle" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" -dependencies = [ - "cty", -] - -[[package]] -name = "raw-window-handle" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a" -dependencies = [ - "cty", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "regex" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - -[[package]] -name = "renderdoc-sys" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157" - -[[package]] -name = "run-wasm" -version = "0.1.0" -dependencies = [ - "cargo-run-wasm", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustix" -version = "0.36.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4feacf7db682c6c329c4ede12649cd36ecab0f3be5b7d74e6a20304725db4549" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.42.0", -] - [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" - -[[package]] -name = "safe_arch" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ff3d6d9696af502cc3110dacce942840fb06ff4514cad92236ecc455f2ce05" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "sctk-adwaita" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61270629cc6b4d77ec1907db1033d5c2e1a404c412743621981a871dc9c12339" -dependencies = [ - "crossfont", - "log", - "smithay-client-toolkit", - "tiny-skia", -] +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +dependencies = [ + "serde_derive", +] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", @@ -1303,9 +404,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa", "ryu", @@ -1313,130 +414,56 @@ dependencies = [ ] [[package]] -name = "servo-fontconfig" -version = "0.5.1" +name = "sha2" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e3e22fe5fd73d04ebf0daa049d3efe3eae55369ce38ab16d07ddd9ac5c217c" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "libc", - "servo-fontconfig-sys", + "cfg-if", + "cpufeatures", + "digest", ] [[package]] -name = "servo-fontconfig-sys" -version = "5.1.0" +name = "simd-adler32" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36b879db9892dfa40f95da1c38a835d41634b825fbd8c4c418093d53c24b388" -dependencies = [ - "expat-sys", - "freetype-sys", - "pkg-config", -] +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "slotmap" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +checksum = "dbff4acf519f630b3a3ddcfaea6c06b42174d9a44bc70c620e9ed1649d58b82a" dependencies = [ "version_check", ] -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "smithay-client-toolkit" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" -dependencies = [ - "bitflags", - "calloop", - "dlib", - "lazy_static", - "log", - "memmap2", - "nix 0.24.3", - "pkg-config", - "wayland-client", - "wayland-cursor", - "wayland-protocols", -] - -[[package]] -name = "spirv" -version = "0.2.0+1.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" -dependencies = [ - "bitflags", - "num-traits", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - [[package]] name = "syn" -version = "1.0.107" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "tempfile" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" -dependencies = [ - "cfg-if", - "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", -] - -[[package]] -name = "termcolor" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", @@ -1444,68 +471,28 @@ dependencies = [ ] [[package]] -name = "tiny-skia" -version = "0.7.0" +name = "ttf-parser" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642680569bb895b16e4b9d181c60be1ed136fa0c9c7f11d004daf053ba89bf82" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "bytemuck", - "cfg-if", - "png", - "safe_arch", - "tiny-skia-path", -] +checksum = "7b3e06c9b9d80ed6b745c7159c40b311ad2916abb34a49e9be2653b90db0d8dd" [[package]] -name = "tiny-skia-path" -version = "0.7.0" +name = "typenum" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c114d32f0c2ee43d585367cb013dfaba967ab9f62b90d9af0d696e955e70fa6c" -dependencies = [ - "arrayref", - "bytemuck", -] +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] -name = "toml" -version = "0.5.10" +name = "ucd-trie" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" -dependencies = [ - "serde", -] +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" - -[[package]] -name = "unicode-segmentation" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" - -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "version_check" @@ -1513,391 +500,15 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "walrus" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb08e48cde54c05f363d984bb54ce374f49e242def9468d2e1b6c2372d291f8" -dependencies = [ - "anyhow", - "id-arena", - "leb128", - "log", - "walrus-macro", - "wasmparser 0.77.0", -] - -[[package]] -name = "walrus-macro" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6e5bd22c71e77d60140b0bd5be56155a37e5bd14e24f5f87298040d0cc40d7" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-cli-support" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03f35e0387a2c787ca5ee299bfb4259352b2a2184b406f8ee9f978c3c4671645" -dependencies = [ - "anyhow", - "base64", - "log", - "rustc-demangle", - "serde_json", - "tempfile", - "walrus", - "wasm-bindgen-externref-xform", - "wasm-bindgen-multi-value-xform", - "wasm-bindgen-shared", - "wasm-bindgen-threads-xform", - "wasm-bindgen-wasm-conventions", - "wasm-bindgen-wasm-interpreter", - "wit-text", - "wit-validator", - "wit-walrus", -] - -[[package]] -name = "wasm-bindgen-externref-xform" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d010a32a516a793adbea5835eab6f736d11c0cdd10ebe0c762c420f67510244" -dependencies = [ - "anyhow", - "walrus", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-multi-value-xform" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b8c8d5dcc451b7e6a9c98d8fd966ff768a1e8f8afb270a829780086f2885ac" -dependencies = [ - "anyhow", - "walrus", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" - -[[package]] -name = "wasm-bindgen-threads-xform" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d10f9246c4daa911283a7096fc3be9f1fab9e3e36400478a4ab8d7056701420" -dependencies = [ - "anyhow", - "walrus", - "wasm-bindgen-wasm-conventions", -] - -[[package]] -name = "wasm-bindgen-wasm-conventions" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a5ab217f12f73b7c3ff23cbbbb5d36f7ee97dd65bb0be44beebda887df9002" -dependencies = [ - "anyhow", - "walrus", -] - -[[package]] -name = "wasm-bindgen-wasm-interpreter" -version = "0.2.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fbb6c773b486889b7c1211d27a7a08eebaf54ec4269380266cadf69e269cd91" -dependencies = [ - "anyhow", - "log", - "walrus", - "wasm-bindgen-wasm-conventions", -] - -[[package]] -name = "wasmparser" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a950e6a618f62147fd514ff445b2a0b53120d382751960797f85f058c7eda9b9" - -[[package]] -name = "wasmparser" -version = "0.77.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35c86d22e720a07d954ebbed772d01180501afe7d03d464f413bb5f8914a8d6" - -[[package]] -name = "wast" -version = "21.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b1844f66a2bc8526d71690104c0e78a8e59ffa1597b7245769d174ebb91deb5" -dependencies = [ - "leb128", -] - -[[package]] -name = "wayland-client" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" -dependencies = [ - "bitflags", - "downcast-rs", - "libc", - "nix 0.24.3", - "scoped-tls", - "wayland-commons", - "wayland-scanner", - "wayland-sys", -] - -[[package]] -name = "wayland-commons" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691f134d584a33a6606d9d717b95c4fa20065605f798a3f350d78dced02a902" -dependencies = [ - "nix 0.24.3", - "once_cell", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-cursor" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6865c6b66f13d6257bef1cd40cbfe8ef2f150fb8ebbdb1e8e873455931377661" -dependencies = [ - "nix 0.24.3", - "wayland-client", - "xcursor", -] - -[[package]] -name = "wayland-protocols" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" -dependencies = [ - "bitflags", - "wayland-client", - "wayland-commons", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" -dependencies = [ - "proc-macro2", - "quote", - "xml-rs", -] - -[[package]] -name = "wayland-sys" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be12ce1a3c39ec7dba25594b97b42cb3195d54953ddb9d3d95a7c3902bc6e9d4" -dependencies = [ - "dlib", - "lazy_static", - "pkg-config", -] - -[[package]] -name = "web-sys" -version = "0.3.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "wedge" version = "0.1.0" dependencies = [ - "console_error_panic_hook", - "console_log", - "env_logger", - "pollster", - "wasm-bindgen-futures", - "web-sys", - "wgpu", - "winit", -] - -[[package]] -name = "wgpu" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f643110d228fd62a60c5ed2ab56c4d5b3704520bd50561174ec4ec74932937" -dependencies = [ - "arrayvec 0.7.2", - "js-sys", - "log", - "naga", - "parking_lot", - "raw-window-handle 0.5.0", - "smallvec", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-core" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6000d1284ef8eec6076fd5544a73125fd7eb9b635f18dceeb829d826f41724ca" -dependencies = [ - "arrayvec 0.7.2", - "bit-vec", - "bitflags", - "cfg_aliases", - "codespan-reporting", - "fxhash", - "log", - "naga", - "parking_lot", - "profiling", - "raw-window-handle 0.5.0", - "smallvec", - "thiserror", - "web-sys", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-hal" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc320a61acb26be4f549c9b1b53405c10a223fbfea363ec39474c32c348d12f" -dependencies = [ - "android_system_properties", - "arrayvec 0.7.2", - "ash", - "bit-set", - "bitflags", - "block", - "core-graphics-types", - "d3d12", - "foreign-types 0.3.2", - "fxhash", - "glow", - "gpu-alloc", - "gpu-descriptor", - "js-sys", - "khronos-egl", - "libloading", - "log", - "metal", - "naga", - "objc", - "parking_lot", - "profiling", - "range-alloc", - "raw-window-handle 0.5.0", - "renderdoc-sys", - "smallvec", - "thiserror", - "wasm-bindgen", - "web-sys", - "wgpu-types", - "winapi", -] - -[[package]] -name = "wgpu-types" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb6b28ef22cac17b9109b25b3bf8c9a103eeb293d7c5f78653979b09140375f6" -dependencies = [ - "bitflags", + "anyhow", + "json5", + "macroquad", + "serde", + "serde_json", ] [[package]] @@ -1916,15 +527,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1932,233 +534,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows-sys" -version = "0.36.1" +name = "zerocopy" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", + "zerocopy-derive", ] [[package]] -name = "windows-sys" -version = "0.42.0" +name = "zerocopy-derive" +version = "0.7.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "proc-macro2", + "quote", + "syn", ] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" - -[[package]] -name = "winit" -version = "0.27.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb796d6fbd86b2fd896c9471e6f04d39d750076ebe5680a3958f00f5ab97657c" -dependencies = [ - "bitflags", - "cocoa", - "core-foundation", - "core-graphics", - "dispatch", - "instant", - "libc", - "log", - "mio", - "ndk", - "ndk-glue", - "objc", - "once_cell", - "parking_lot", - "percent-encoding", - "raw-window-handle 0.4.3", - "raw-window-handle 0.5.0", - "sctk-adwaita", - "smithay-client-toolkit", - "wasm-bindgen", - "wayland-client", - "wayland-protocols", - "web-sys", - "windows-sys 0.36.1", - "x11-dl", -] - -[[package]] -name = "wio" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" -dependencies = [ - "winapi", -] - -[[package]] -name = "wit-parser" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f5fd97866f4b9c8e1ed57bcf9446f3d0d8ba37e2dd01c3c612c046c053b06f7" -dependencies = [ - "anyhow", - "leb128", - "wit-schema-version", -] - -[[package]] -name = "wit-schema-version" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfee4a6a4716eefa0682e7a3b836152e894a3e4f34a9d6c2c3e1c94429bfe36a" - -[[package]] -name = "wit-text" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33358e95c77d660f1c7c07f4a93c2bd89768965e844e3c50730bb4b42658df5f" -dependencies = [ - "anyhow", - "wast", - "wit-writer", -] - -[[package]] -name = "wit-validator" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c11d93d925420e7872b226c4161849c32be38385ccab026b88df99d8ddc6ba6" -dependencies = [ - "anyhow", - "wasmparser 0.59.0", - "wit-parser", - "wit-schema-version", -] - -[[package]] -name = "wit-walrus" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad559e3e4c6404b2a6a675d44129d62a3836e3b951b90112fa1c5feb852757cd" -dependencies = [ - "anyhow", - "id-arena", - "walrus", - "wit-parser", - "wit-schema-version", - "wit-writer", -] - -[[package]] -name = "wit-writer" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ad01ba5e9cbcff799a0689e56a153776ea694cec777f605938cb9880d41a09" -dependencies = [ - "leb128", - "wit-schema-version", -] - -[[package]] -name = "x11-dl" -version = "2.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1536d6965a5d4e573c7ef73a2c15ebcd0b2de3347bdf526c34c297c00ac40f0" -dependencies = [ - "lazy_static", - "libc", - "pkg-config", -] - -[[package]] -name = "xcursor" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" -dependencies = [ - "nom", -] - -[[package]] -name = "xml-rs" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" diff --git a/Cargo.toml b/Cargo.toml index 1e6a60c..253fd82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,17 +3,11 @@ name = "wedge" version = "0.1.0" edition = "2021" -[workspace] -members = ["run-wasm"] +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -env_logger = "0.10.0" -pollster = "0.2.5" -wgpu = { version = "0.14.2", features = ["webgl"] } -winit = "0.27.5" - -# wasm -console_error_panic_hook = "0.1.7" -console_log = "0.2.0" -wasm-bindgen-futures = "0.4.33" -web-sys = "0.3.60" +anyhow = "1.0.79" +json5 = "0.4.1" +macroquad = "0.4.4" +serde = { version = "1.0.195", features = ["derive"] } +serde_json = "1.0.111" diff --git a/build.rs b/build.rs deleted file mode 100644 index d74660e..0000000 --- a/build.rs +++ /dev/null @@ -1,14 +0,0 @@ -fn main() { - // if cfg!(target_os = "linux") { - // for path in env!("LD_LIBRARY_PATH").split(":") { - // println!(r"cargo:rustc-link-search={}", path); - // } - - // println!("cargo:rustc-link-lib=X11"); - // println!("cargo:rustc-link-lib=Xcursor"); - // println!("cargo:rustc-link-lib=Xrandr"); - // println!("cargo:rustc-link-lib=Xi"); - // println!("cargo:rustc-link-lib=vulkan"); - - // } -} diff --git a/flake.lock b/flake.lock index 4a7eeae..1d3af03 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1672554122, - "narHash": "sha256-vTnoOiRQtjaqdW0Hmtz73GyWEcyQstifpoZ7QAscWyA=", + "lastModified": 1706163833, + "narHash": "sha256-Vw+jTVtKceT+ScaIn7tHy8JjRZZpmg2fAdoInLAsW/M=", "owner": "nix-community", "repo": "fenix", - "rev": "f62d27fa582511fe4d1c32855b8cb4c57e335d9d", + "rev": "043f63f55e9c9b808852ea82edee1f2a1af37e91", "type": "github" }, "original": { @@ -22,12 +22,15 @@ } }, "flake-utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -37,11 +40,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1667629849, - "narHash": "sha256-P+v+nDOFWicM4wziFK9S/ajF2lc0N2Rg9p6Y35uMoZI=", - "owner": "nixos", + "lastModified": 1706006310, + "narHash": "sha256-nDPz0fj0IFcDhSTlXBU2aixcnGs2Jm4Zcuoj0QtmiXQ=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "3bacde6273b09a21a8ccfba15586fb165078fb62", + "rev": "b43bb235efeab5324c5e486882ef46749188eee2", "type": "github" }, "original": { @@ -59,11 +62,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1672498287, - "narHash": "sha256-K2ywmLEJ32D0vtmMHmRUymX2FmHi+kklyLYYcyCV5QY=", + "lastModified": 1706106882, + "narHash": "sha256-31DivWu0cC50gR2CgbGtLCf77nuiw4kdiI7B8ioqzLw=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "f31733b1d61dd8ab2012bbe466838be244a96dd3", + "rev": "0d52934d19d7addcafcfda92a1d547b51556beec", "type": "github" }, "original": { @@ -72,6 +75,21 @@ "repo": "rust-analyzer", "type": "github" } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index b627cb8..ac6338e 100644 --- a/flake.nix +++ b/flake.nix @@ -14,15 +14,16 @@ overlays = [ fenix.overlays.default ]; }; - rustc = pkgs.fenix.default.rustc; - cargo = pkgs.fenix.default.cargo; + rustc = pkgs.fenix.stable.rustc; + cargo = pkgs.fenix.stable.cargo; neededLibs = with pkgs; - (with xorg; [ libX11 libXcursor libXrandr libXi ]) - ++ [ vulkan-loader wayland wayland-protocols libxkbcommon ]; + (with xorg; [ ]) + ++ [ ]; flakePkgs = { wedge = pkgs.callPackage ./. { inherit rustc cargo; }; }; - in rec { + in + rec { packages = flake-utils.lib.flattenTree flakePkgs; defaultPackage = packages.wedge; @@ -36,27 +37,27 @@ ''; packages = (with pkgs; [ - cargo-watch - cargo-deny - cargo-edit - sqlx-cli - sqlite - wasm-pack + # cargo-watch + # cargo-deny + # cargo-edit + # sqlx-cli + # sqlite + (with pkgs.fenix; - combine [ - rustc - cargo - targets.wasm32-unknown-unknown.latest.rust-std - ]) + combine [ + rustc + cargo + # targets.wasm32-unknown-unknown.latest.rust-std + ]) ]); PKG_CONFIG_PATH = with pkgs; lib.concatStringsSep ":" [ - "${fontconfig.dev}/lib/pkgconfig" - "${xorg.libX11.dev}/lib/pkgconfig" - "${xorg.libXcursor.dev}/lib/pkgconfig" - "${xorg.libXi.dev}/lib/pkgconfig" - "${xorg.libXrandr.dev}/lib/pkgconfig" + # "${fontconfig.dev}/lib/pkgconfig" + # "${xorg.libX11.dev}/lib/pkgconfig" + # "${xorg.libXcursor.dev}/lib/pkgconfig" + # "${xorg.libXi.dev}/lib/pkgconfig" + # "${xorg.libXrandr.dev}/lib/pkgconfig" ]; }; }); diff --git a/levels/level1.json b/levels/level1.json new file mode 100644 index 0000000..082f38d --- /dev/null +++ b/levels/level1.json @@ -0,0 +1,124 @@ +{ + "dimensions": [8, 8], + "player1": { + "position": [5, 5], + "color": [66, 134, 244], + }, + "player2": { + "position": [5, 5], + "color": [244, 83, 65], + }, + "goal1": [0, 0], + "goal2": [0, 0], + "blocks": [ + { + "movable": true, + "orientation": 2, + "color": [255, 10, 100], + "segments": [ + [6, 4, 2, 0], + [6, 5, 0, 0], + ], + }, + { + "movable": true, + "orientation": 1, + "color": [0, 255, 100], + "segments": [ + [4, 3, 2, 0], + [5, 3, 0, 0], + [6, 3, 4, 0], + [4, 3, 2, 1], + [5, 3, 0, 1], + [6, 3, 4, 1], + ], + }, + { + "movable": true, + "orientation": 2, + "color": [20, 25, 100], + "segments": [ + [6, 2, 4, 0], + [6, 1, 0, 0], + [6, 2, 4, 1], + [6, 1, 0, 1], + ], + }, + { + "movable": true, + "orientation": 1, + "color": [110, 30, 230], + "segments": [ + [3, 5, 4, 0], + [2, 5, 0, 0], + [1, 5, 0, 0], + [3, 5, 4, 1], + [2, 5, 0, 1], + [1, 5, 0, 1], + ], + }, + { + "movable": true, + "orientation": 2, + "color": [240, 50, 60], + "segments": [ + [3, 5, 2, 0], + [3, 6, 0, 0], + ], + }, + { + "movable": true, + "orientation": 2, + "color": [120, 220, 20], + "segments": [ + [3, 3, 4, 1], + [3, 2, 0, 1], + ], + }, + { + "movable": false, + "orientation": 0, + "color": [0, 0, 0], + "segments": [ + [2, 0, 0, 0], + [2, 1, 0, 0], + [2, 2, 0, 0], + [2, 3, 0, 0], + [2, 0, 0, 1], + [2, 1, 0, 1], + [2, 2, 0, 1], + [2, 3, 0, 1], + ], + }, + { + "movable": false, + "orientation": 0, + "color": [0, 0, 0], + "segments": [ + [4, 4, 0, 0], + [4, 5, 0, 0], + [4, 6, 0, 0], + [4, 7, 0, 0], + [4, 4, 0, 1], + [4, 5, 0, 1], + [4, 6, 0, 1], + [4, 7, 0, 1], + ], + }, + { + "movable": false, + "orientation": 0, + "color": [0, 0, 0], + "segments": [ + [7, 4, 0, 0], + [7, 5, 0, 0], + [7, 6, 0, 0], + [7, 7, 0, 0], + [7, 4, 0, 1], + [7, 5, 0, 1], + [7, 6, 0, 1], + [7, 7, 0, 1], + ], + }, + ], +} diff --git a/levels/tutorial.json b/levels/tutorial.json new file mode 100644 index 0000000..9f07705 --- /dev/null +++ b/levels/tutorial.json @@ -0,0 +1,67 @@ +{ + "dimensions": [3, 7], + "player1": { + "position": [1, 6], + "color": [66, 134, 244], + }, + "player2": { + "position": [1, 6], + "color": [244, 83, 65], + }, + "goal1": [1, 0], + "goal2": [1, 0], + "blocks": [ + { + "movable": true, + "orientation": 1, + "color": [255, 10, 100], + "segments": [ + [1, 3, 0, 0], + [2, 3, 4, 0], + ], + }, + { + "movable": true, + "orientation": 2, + "color": [105, 210, 50], + "segments": [ + [2, 4, 2, 0], + [2, 5, 0, 0], + ], + }, + { + "movable": true, + "orientation": 2, + "color": [35, 150, 100], + "segments": [ + [0, 4, 1, 1], + [0, 5, 0, 1], + ], + }, + { + "movable": true, + "orientation": 1, + "color": [25, 120, 10], + "segments": [ + [0, 3, 3, 1], + [1, 3, 0, 1], + ], + }, + { + "movable": false, + "orientation": 0, + "color": [15, 15, 15], + "segments": [ + [0, 2, 0, 0], + ], + }, + { + "movable": false, + "orientation": 0, + "color": [15, 15, 15], + "segments": [ + [2, 2, 0, 1], + ], + }, + ] +} diff --git a/levels/tutorial2.json b/levels/tutorial2.json new file mode 100644 index 0000000..a42fde5 --- /dev/null +++ b/levels/tutorial2.json @@ -0,0 +1,54 @@ +{ + "dimensions": [4, 8], + "player1": { + "position": [1, 7], + "color": [66, 134, 244], + }, + "player2": { + "position": [1, 7], + "color": [244, 83, 65], + }, + "goal1": [0, 0], + "goal2": [3, 0], + "blocks": [ + { + "movable": false, + "orientation": 1, + "color": [0, 0, 0], + "segments": [ + [0, 2, 0, 0], + [3, 2, 0, 0], + [0, 4, 0, 0], + [3, 4, 0, 0], + [3, 6, 0, 0], + [0, 2, 0, 1], + [3, 2, 0, 1], + [0, 4, 0, 1], + [0, 6, 0, 1], + [3, 6, 0, 1], + ], + }, + { + "movable": true, + "orientation": 1, + "color": [255, 10, 100], + "segments": [ + [1, 5, 0, 0], + [2, 5, 4, 0], + [1, 5, 0, 1], + [2, 5, 4, 1], + ], + }, + { + "movable": true, + "orientation": 1, + "color": [10, 255, 100], + "segments": [ + [1, 3, 3, 0], + [2, 3, 0, 0], + [1, 3, 3, 1], + [2, 3, 0, 1], + ], + }, + ], +} diff --git a/run-wasm/Cargo.toml b/run-wasm/Cargo.toml deleted file mode 100644 index a6cf8b4..0000000 --- a/run-wasm/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "run-wasm" -version = "0.1.0" -edition = "2021" - -[dependencies] -cargo-run-wasm = "0.3.0" diff --git a/run-wasm/src/main.rs b/run-wasm/src/main.rs deleted file mode 100644 index 6961358..0000000 --- a/run-wasm/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - cargo_run_wasm::run_wasm_with_css("body { margin: 0px; }"); -} diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..22f4704 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,4 @@ +max_width = 80 +tab_spaces = 2 +wrap_comments = true +fn_single_line = true diff --git a/src/animations.rs b/src/animations.rs new file mode 100644 index 0000000..9f2ca06 --- /dev/null +++ b/src/animations.rs @@ -0,0 +1,116 @@ +use std::collections::{HashMap, HashSet}; +use std::time::Duration; + +use crate::game_state::level::{ChangeSet, Entity, FailSet}; +use crate::game_state::Board; + +pub type MoveResult = Result; +pub type BlockOffsets = HashMap; + +// TODO: don't yeet around a HashMap all the time +pub type AnimationFn = + Box BlockOffsets>; + +// in seconds +const ANIMATION_DURATION: f32 = 1.0 / 6.0; + +#[derive(Default)] +pub struct AnimationState { + pub is_animating: bool, + pub last_move_result: Option, + pub progress: f32, + pub block_offsets: BlockOffsets, + pub immovable_blocks: HashSet, + progress_function: Option, +} + +impl AnimationState { + pub fn new() -> Self { + AnimationState { + is_animating: false, + last_move_result: None, + progress: 0.0, + block_offsets: BlockOffsets::new(), + immovable_blocks: HashSet::new(), + progress_function: None, + } + } + + pub fn begin_move_transition(&mut self, result: MoveResult) { + println!("result: {:?}", result); + self.last_move_result = Some(result); + self.is_animating = true; + self.progress = 0.0; + + let func = |last_move_result: MoveResult, + mut offsets: BlockOffsets, + progress: f32| { + use std::f32::consts::PI; + match last_move_result { + // transition + Ok(change_set) => { + for (entity, direction) in change_set { + // TODO: implement ease-out? + let pair = direction.as_pair(); + // cap progress at 1.0, we don't want blocks going past where they're supposed to + let progress = progress.min(1.0); + let offset = (pair.0 as f32 * progress, pair.1 as f32 * progress); + offsets.insert(entity, offset); + } + } + + // vibrate all blocking pieces + Err(fail_set) => { + for index in fail_set { + let delta = 0.05 * (4.0 * PI * progress).sin() / (progress + 0.5); + offsets.insert(Entity::Block(index), (delta, delta)); + } + } + } + offsets + }; + self.progress_function = Some(Box::new(func)); + } + + pub fn make_progress(&mut self, delta: Duration) { + let progress = + self.progress + (delta.as_millis() as f32 / ANIMATION_DURATION) / 1000.0; + + let block_offsets = if let Some(f) = &self.progress_function { + Some(f( + self.last_move_result.clone().unwrap(), + self.block_offsets.clone(), + progress, + )) + } else { + None + }; + + // this should always work + if let Some(block_offsets) = block_offsets { + self.block_offsets = block_offsets; + self.progress = progress; + } + + if self.progress > 1.0 { + self.is_animating = false; + self.block_offsets = BlockOffsets::new(); + } + } + + pub fn get_block_offset(&self, index: usize) -> (f32, f32) { + self + .block_offsets + .get(&Entity::Block(index)) + .cloned() + .unwrap_or_else(|| (0.0, 0.0)) + } + + pub fn get_player_offset(&self, board: Board) -> (f32, f32) { + self + .block_offsets + .get(&Entity::Player(board)) + .cloned() + .unwrap_or_else(|| (0.0, 0.0)) + } +} diff --git a/src/draw.rs b/src/draw.rs new file mode 100644 index 0000000..62421b9 --- /dev/null +++ b/src/draw.rs @@ -0,0 +1 @@ +pub fn draw() {} diff --git a/src/game_state/block.rs b/src/game_state/block.rs new file mode 100644 index 0000000..62cdc81 --- /dev/null +++ b/src/game_state/block.rs @@ -0,0 +1,35 @@ +use super::{BlockData, Color, Orientation, SegmentState}; + +#[derive(Clone, Debug)] +pub struct BlockState { + pub index: usize, + pub movable: bool, + pub color: Color, + pub orientation: Orientation, + pub segments: Vec, +} + +impl BlockState { + pub fn from_data(index: usize, data: &BlockData) -> Self { + let movable = data.movable; + let segments = data + .segments + .iter() + .map(|segment| SegmentState { + position: (segment[0], segment[1]), + shape: segment[2].into(), + board: segment[3].into(), + }) + .collect(); + let orientation = data.orientation.into(); + let color = Color(data.color.0, data.color.1, data.color.2); + + BlockState { + index, + movable, + color, + segments, + orientation, + } + } +} diff --git a/src/game_state/level.rs b/src/game_state/level.rs new file mode 100644 index 0000000..15ee360 --- /dev/null +++ b/src/game_state/level.rs @@ -0,0 +1,48 @@ +use std::collections::{HashMap, HashSet}; + +use super::{Board, LevelState, PushDir, Shape}; + +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] +pub enum Entity { + Block(usize), + Player(Board), +} + +pub type ChangeSet = HashMap; + +pub type FailSet = HashSet; + +impl LevelState { + pub fn apply_change_set(&mut self, change_set: ChangeSet) { + for (entity, direction) in change_set { + let direction = direction.as_pair(); + match entity { + Entity::Player(board) => { + let player = match board { + Board::Left => &mut self.player1_position, + Board::Right => &mut self.player2_position, + }; + player.0 += direction.0; + player.1 += direction.1; + } + Entity::Block(index) => { + let block = self.blocks.get_mut(index).expect("big failure"); + for segment in &mut block.segments { + segment.position.0 += direction.0; + segment.position.1 += direction.1; + } + } + } + } + } + + pub fn try_move( + &mut self, + board: Board, + direction: PushDir, + ) -> Result { + let mut change_set = ChangeSet::default(); + change_set.insert(Entity::Player(board), direction); + self.player_can_move(board, direction, change_set) + } +} diff --git a/src/game_state/mod.rs b/src/game_state/mod.rs new file mode 100644 index 0000000..01adeef --- /dev/null +++ b/src/game_state/mod.rs @@ -0,0 +1,197 @@ +pub mod block; +pub mod level; +pub mod move_rules; +pub mod render; + +use std::ops::Add; + +use anyhow::Result; +use macroquad::color::Color as MQColor; + +use self::block::BlockState; + +#[derive(Debug)] +pub struct LevelState { + pub data: LevelData, + pub blocks: Vec, + pub player1_position: (i32, i32), + pub player2_position: (i32, i32), +} + +#[derive(Copy, Clone, Debug, PartialOrd, PartialEq)] +pub struct SegmentState { + position: (i32, i32), + shape: Shape, + board: Board, +} + +impl LevelState { + pub fn new(data: LevelData) -> Self { + let blocks = data + .blocks + .iter() + .enumerate() + .map(|(i, block)| BlockState::from_data(i, block)) + .collect(); + + LevelState { + blocks, + player1_position: data.player1.position, + player2_position: data.player2.position, + data, + } + } + + pub fn check_win_condition(&self) -> bool { + self.player1_position == self.data.goal1 + && self.player2_position == self.data.goal2 + } +} + +#[derive(Clone, Copy, Debug, Serialize, Deserialize)] +pub struct Color(u8, u8, u8); + +impl Into for Color { + fn into(self) -> MQColor { + MQColor::from_rgba(self.0, self.1, self.2, 255) + } +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct PlayerData { + pub position: (i32, i32), + pub color: Color, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct BlockData { + pub movable: bool, + pub orientation: u32, + pub color: Color, + pub segments: Vec<[i32; 4]>, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct LevelData { + pub dimensions: [u32; 2], + pub player1: PlayerData, + pub player2: PlayerData, + pub goal1: (i32, i32), + pub goal2: (i32, i32), + pub blocks: Vec, +} + +impl LevelData { + pub fn load_from_string(string: &str) -> Result { + json5::from_str(string).map_err(|err| err.into()) + } +} + +#[derive(Debug, Eq, PartialEq, Hash, PartialOrd, Copy, Clone)] +pub enum Board { + Left = 0, + Right = 1, +} + +impl From for Board { + fn from(n: i32) -> Self { + match n { + 0 => Board::Left, + 1 => Board::Right, + _ => panic!("expecting 0 or 1, got {}", n), + } + } +} + +#[derive(Copy, Clone, Debug)] +pub enum Orientation { + None = 0, + Horizontal = 1, + Vertical = 2, + Both = 3, +} + +impl From for Orientation { + fn from(n: u32) -> Self { + match n { + 0 => Orientation::Both, + 1 => Orientation::Horizontal, + 2 => Orientation::Vertical, + _ => panic!("expecting 0..2, got {}", n), + } + } +} + +#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] +pub enum PushDir { + Up, + Down, + Left, + Right, +} + +impl PushDir { + pub fn as_pair(self) -> (i32, i32) { + match self { + PushDir::Up => (0, -1), + PushDir::Down => (0, 1), + PushDir::Left => (-1, 0), + PushDir::Right => (1, 0), + } + } +} + +impl Add for (i32, i32, Board) { + type Output = (i32, i32, Board); + + fn add(self, rhs: PushDir) -> Self::Output { + let offset = rhs.as_pair(); + (self.0 + offset.0, self.1 + offset.1, self.2) + } +} + +// /\ +// /21\ +// \34/ +// \/ +#[derive(Copy, Clone, Debug, PartialOrd, PartialEq)] +pub enum Shape { + Full = 0, + TopRight = 1, + TopLeft = 2, + BottomLeft = 3, + BottomRight = 4, +} + +impl From for Shape { + fn from(n: i32) -> Self { + match n { + 0 => Shape::Full, + 1 => Shape::TopRight, + 2 => Shape::TopLeft, + 3 => Shape::BottomLeft, + 4 => Shape::BottomRight, + _ => panic!("expecting 0..4, got {}", n), + } + } +} + +impl Shape { + pub fn get_opposite(self) -> Option { + use Shape::*; + match self { + TopRight => Some(BottomLeft), + BottomLeft => Some(TopRight), + TopLeft => Some(BottomRight), + BottomRight => Some(TopLeft), + Full => None, + } + } + + pub fn is_opposite(self, other: Shape) -> bool { + self + .get_opposite() + .map(|shape| shape == other) + .unwrap_or_else(|| false) + } +} diff --git a/src/game_state/move_rules.rs b/src/game_state/move_rules.rs new file mode 100644 index 0000000..806c30d --- /dev/null +++ b/src/game_state/move_rules.rs @@ -0,0 +1,245 @@ +use std::collections::HashSet; + +use crate::game_state::{level::Entity, Board, Orientation, PushDir, Shape}; + +use super::{ + level::{ChangeSet, FailSet}, + LevelState, SegmentState, +}; + +impl LevelState { + pub fn player_can_move( + &self, + board: Board, + direction: PushDir, + change_set: ChangeSet, + ) -> Result { + let player_position = match board { + Board::Left => &self.player1_position, + Board::Right => &self.player2_position, + }; + let player_segment = SegmentState { + position: *player_position, + shape: Shape::Full, + board, + }; + self.segment_can_move(None, player_segment, direction, change_set) + } + + fn block_can_move( + &self, + index: usize, + direction: PushDir, + mut change_set: ChangeSet, + ) -> Result { + println!("block_can_move({:?}, {:?})", index, direction); + let block = match self.blocks.get(index) { + Some(block) => block, + None => return Err(HashSet::new()), + }; + + // is the block even movable? + if !block.movable { + return Err(set!(index)); + } + + // does the direction match the orientation? + match (block.orientation, direction) { + (Orientation::Horizontal, PushDir::Left) + | (Orientation::Horizontal, PushDir::Right) + | (Orientation::Vertical, PushDir::Up) + | (Orientation::Vertical, PushDir::Down) + | (Orientation::Both, _) => (), + _ => return Err(set!(index)), + } + + // TODO: change this to use &mut instead of returning a new one each time + change_set.insert(Entity::Block(index), direction); + for segment in block.segments.iter() { + match self.segment_can_move( + Some(index), + segment.clone(), + direction, + change_set.clone(), + ) { + Ok(new_change_set) => change_set = new_change_set, + Err(fail_set) => return Err(fail_set), + } + } + + Ok(change_set) + } + + fn segment_can_move( + &self, + block_index: Option, + segment: SegmentState, + direction: PushDir, + change_set: ChangeSet, + ) -> Result { + println!( + "segment_can_move({:?}, {:?}, {:?})", + block_index, segment, direction + ); + let segment_loc = (segment.position.0, segment.position.1, segment.board); + let target = segment_loc + direction; + println!(" - target: {:?}", target); + + // is the target actually in the map? + if target.0 < 0 + || target.0 >= self.data.dimensions[0] as i32 + || target.1 < 0 + || target.1 >= self.data.dimensions[1] as i32 + { + return Err(entity_fail!(block_index)); + } + + // retrieve other blocks that might be occupying this current space and the target space + let mut current_occupant = None; + let mut target_occupant = None; + for (i, block) in self.blocks.iter().enumerate() { + // skip other segments of the same block + if let Some(n) = block_index { + if n == i { + continue; + } + } + + // offset from the change set + let offset = match change_set.get(&Entity::Block(i)) { + Some(direction) => direction.as_pair(), + None => (0, 0), + }; + + for segment in block.segments.iter() { + // don't get segments on different boards + if segment.board != segment_loc.2 { + continue; + } + + let mut segment_pos = segment.position; + + if segment_pos == (segment_loc.0, segment_loc.1) { + current_occupant = Some((i, segment.shape, block.orientation)); + } + + segment_pos.0 += offset.0; + segment_pos.1 += offset.1; + + if segment_pos == (target.0, target.1) { + target_occupant = + Some((Entity::Block(i), segment.shape, block.orientation)); + } + } + } + // check if the target occupant is actually a player + if let None = target_occupant { + if segment.board == Board::Left + && self.player1_position == (target.0, target.1) + { + target_occupant = + Some((Entity::Player(Board::Left), Shape::Full, Orientation::None)); + } else if segment.board == Board::Right + && self.player2_position == (target.0, target.1) + { + target_occupant = + Some((Entity::Player(Board::Right), Shape::Full, Orientation::None)); + } + } + + println!( + " - occupants: current={:?} | target={:?}", + current_occupant, target_occupant + ); + + // handle special pushes + if let Some((other_block, other_shape, other_orientation)) = + current_occupant + { + // are both shapes triangles? + let both_triangles = match (segment.shape, other_shape) { + (Shape::Full, Shape::Full) => false, + (Shape::Full, _) => unreachable!("invalid to have triangle + full"), + (_, Shape::Full) => unreachable!("invalid to have triangle + full"), + _ => true, + }; + + if both_triangles { + // what directions could we be pushing the other block into? + let possible_directions = match segment.shape { + Shape::TopRight => [PushDir::Up, PushDir::Right], + Shape::TopLeft => [PushDir::Left, PushDir::Up], + Shape::BottomLeft => [PushDir::Down, PushDir::Left], + Shape::BottomRight => [PushDir::Right, PushDir::Down], + Shape::Full => unreachable!("already eliminated this possibility"), + }; + println!(" - possible directions: {:?}", possible_directions); + + // does the direction we're pushing appear in this list? + if possible_directions.contains(&direction) { + // the other shape goes in the other direction + let other_direction = match other_orientation { + Orientation::None => { + unreachable!("already eliminated this possibility") + } + Orientation::Vertical => [PushDir::Up, PushDir::Down], + Orientation::Horizontal => [PushDir::Left, PushDir::Right], + Orientation::Both => unimplemented!(), + }; + + let possible_directions = + possible_directions.iter().collect::>(); + let other_direction = other_direction.iter().collect(); + let mut intersected_direction = + possible_directions.intersection(&other_direction); + let new_direction = **intersected_direction.next().unwrap(); + + // let other_direction = { + // let mut set = possible_directions.iter().collect::>(); + // set.remove(&direction); + // *set.into_iter().next().unwrap() + // }; + + let mut result = + self.block_can_move(other_block, new_direction, change_set); + if let Ok(ref mut change_set) = result { + change_set.insert(Entity::Block(other_block), new_direction); + } + + return result; + } + } + } + + // handle normal pushes + if let Some((entity, shape, _orientation)) = target_occupant { + match entity { + Entity::Player(_) => { + // TODO: assert that the board is the same + Err(fail_set!(change_set)) + } + Entity::Block(index) => { + if + // if it's part of the same block it's ok to push + block_index.is_some() && block_index.unwrap() == index || + // if the shapes are opposite, we can actually both fit into the same spot + segment.shape.is_opposite(shape) + { + Ok(change_set) + } + // if the block is already in the change set, it can't move + else if change_set.contains_key(&Entity::Block(index)) { + Err(fail_set!(change_set)) + } + // if the next block can move then so can this one + else { + self.block_can_move(index, direction, change_set) + } + } + } + } else { + // coast is clear, push away! + Ok(change_set) + } + } +} diff --git a/src/game_state/render.rs b/src/game_state/render.rs new file mode 100644 index 0000000..49991b9 --- /dev/null +++ b/src/game_state/render.rs @@ -0,0 +1,183 @@ +use macroquad::color::Color as MQColor; +use macroquad::math::{vec2, Vec2}; +use macroquad::{ + shapes::draw_rectangle, + window::{screen_height, screen_width}, +}; + +use crate::animations::AnimationState; + +use super::{Board, Color, LevelState, Orientation, Shape}; + +impl LevelState { + pub fn render(&self, animations: &AnimationState) { + let width = screen_width(); + let height = screen_height(); + + // board positioning calculations + let playfield_ratio = (2 * self.data.dimensions[0] + 6) as f32 + / (self.data.dimensions[1] + 4) as f32; + let screen_ratio = width / height; + + let cols = self.data.dimensions[0] as i32; + let rows = self.data.dimensions[1] as i32; + + let (scale, xoff, yoff) = if playfield_ratio > screen_ratio { + let scale = width as f32 / (2 * cols + 6) as f32; + let yoff = height as f32 / 2.0 - (rows + 4) as f32 * scale / 2.0; + (scale, 0.0, yoff) + } else { + let scale = height as f32 / (rows + 4) as f32; + let xoff = width as f32 / 2.0 - (2 * cols + 6) as f32 * scale / 2.0; + (scale, xoff, 0.0) + }; + + let left_offset = vec2(xoff, yoff); + + self.render_boards(scale, left_offset, animations); + } + + fn render_boards( + &self, + scale: f32, + offset: Vec2, + animations: &AnimationState, + ) { + let left_off = (offset.0 + 2 * scale, offset.1 + 2 * scale); + let right_off = ( + offset.0 + (4 + self.data.dimensions[0] as i32) * scale, + offset.1 + 2 * scale, + ); + + // render the grid + // TODO: do this in one single pass instead of once for each cell + for x in 0..self.data.dimensions[0] as i32 { + for y in 0..self.data.dimensions[1] as i32 { + self + .render_cell((left_off.0 + x * scale, left_off.1 + y * scale), scale); + self.render_cell( + (right_off.0 + x * scale, right_off.1 + y * scale), + scale, + ); + } + } + + // render blocks + for (i, block) in self.blocks.iter().enumerate() { + for segment in block.segments.iter() { + let offset = match &segment.board { + Board::Left => left_off, + Board::Right => right_off, + }; + let mut location = ( + offset.0 + segment.position.0 * scale, + offset.1 + segment.position.1 * scale, + ); + let animation_offset = animations.get_block_offset(i); + location.0 += (animation_offset.0 * scale as f32) as i32; + location.1 += (animation_offset.1 * scale as f32) as i32; + self.render_segment( + location, + scale, + block.color, + block.orientation, + segment.shape, + ); + } + } + + // render goals + self.render_goal(self.data.goal1, scale, left_off); + self.render_goal(self.data.goal2, scale, right_off); + + // render player + self.render_player( + Board::Left, + self.player1_position, + self.data.player1.color, + scale, + animations, + left_off, + ); + + self.render_player( + Board::Right, + self.player2_position, + self.data.player1.color, + scale, + animations, + right_off, + ); + } + + fn render_player( + &self, + board: Board, + player_position: (i32, i32), + player_color: Color, + scale: i32, + animations: &AnimationState, + offset: (i32, i32), + ) { + let mut location = ( + offset.0 + player_position.0 * scale + 4, + offset.1 + player_position.1 * scale + 4, + ); + let animation_offset = animations.get_player_offset(board); + location.0 += (animation_offset.0 * scale as f32) as i32; + location.1 += (animation_offset.1 * scale as f32) as i32; + + self.render_segment( + location, + scale - 8, + player_color, + Orientation::Both, + Shape::Full, + ); + } + + fn render_goal(&self, location: (i32, i32), scale: f32, offset: (i32, i32)) { + let position = ( + offset.0 + location.0 * scale + 4, + offset.1 + location.1 * scale + 4, + ); + self.render_segment( + position, + scale - 8, + Color(102, 204, 102), + Orientation::Both, + Shape::Full, + ); + } + + fn render_cell(&self, location: (i32, i32), scale: f32) { + let new_x = location.0 * scale; + let new_y = location.1 * scale; + + let color = MQColor::from_rgba(153, 153, 153, 255); + + draw_rectangle( + new_x as f32, + new_y as f32, + scale as f32, + scale as f32, + color.into(), + ) + } + + fn render_segment( + &self, + location: (i32, i32), + scale: i32, + color: Color, + orientation: Orientation, + shape: Shape, + ) { + // draw_circle( + // location.0 as f32, + // location.1 as f32, + // scale as f32 * 0.8, + // color.into(), + // ); + } +} diff --git a/src/macros.rs b/src/macros.rs new file mode 100644 index 0000000..89de19c --- /dev/null +++ b/src/macros.rs @@ -0,0 +1,30 @@ +macro_rules! set { + ($($item:expr)*) => { + { + let mut set = std::collections::HashSet::new(); + $(set.insert($item);)* + set + } + } +} + +macro_rules! fail_set { + ($change_set:expr) => { + $change_set + .iter() + .filter_map(|(entity, _)| match entity { + Entity::Block(index) => Some(*index), + Entity::Player(_) => None, + }) + .collect() + }; +} + +macro_rules! entity_fail { + ($item:expr) => { + match $item { + Some(index) => set!(index), + None => std::collections::HashSet::new(), + } + }; +} diff --git a/src/main.rs b/src/main.rs index 2b4afcb..2c2ee8a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,165 +1,46 @@ -use std::borrow::Cow; -use winit::{ - event::{Event, WindowEvent}, - event_loop::{ControlFlow, EventLoop}, - window::Window, +#[macro_use] +extern crate serde; + +#[macro_use] +pub mod macros; + +pub mod animations; +pub mod draw; +pub mod game_state; +pub mod screens; + +use anyhow::Result; +use macroquad::{ + prelude::*, + ui::{hash, root_ui, widgets::Window}, }; +use screens::{Screen, ScreenAction}; -async fn run(event_loop: EventLoop<()>, window: Window) { - let size = window.inner_size(); - let instance = wgpu::Instance::new(wgpu::Backends::all()); - let surface = unsafe { instance.create_surface(&window) }; - let adapter = instance - .request_adapter(&wgpu::RequestAdapterOptions { - power_preference: wgpu::PowerPreference::default(), - force_fallback_adapter: false, - // Request an adapter which can render to our surface - compatible_surface: Some(&surface), - }) - .await - .expect("Failed to find an appropriate adapter"); +use crate::screens::{MenuScreen, ScreenStack}; - // Create the logical device and command queue - let (device, queue) = adapter - .request_device( - &wgpu::DeviceDescriptor { - label: None, - features: wgpu::Features::empty(), - // Make sure we use the texture resolution limits from the adapter, so we can support images the size of the swapchain. - limits: wgpu::Limits::downlevel_webgl2_defaults() - .using_resolution(adapter.limits()), - }, - None, - ) - .await - .expect("Failed to create device"); +#[macroquad::main("BasicShapes")] +async fn main() -> Result<()> { + let mut screen_stack = ScreenStack::with(MenuScreen::new()); - // Load the shaders from disk - let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { - label: None, - source: wgpu::ShaderSource::Wgsl(Cow::Borrowed(include_str!("shader.wgsl"))), - }); + loop { + clear_background(WHITE); - let pipeline_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor { - label: None, - bind_group_layouts: &[], - push_constant_ranges: &[], - }); + Window::new(hash!(), vec2(20., 20.), vec2(120., 120.)) + .titlebar(true) + .label("level control") + .ui(&mut root_ui(), |ui| { + ui.button(vec2(0., 0.), "helloge"); - let swapchain_format = surface.get_supported_formats(&adapter)[0]; + let top = screen_stack.top(); + let top = top.as_ref(); + ui.label(vec2(0.0, 10.0), &format!("screen: {}", top.status())); + }); - let render_pipeline = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor { - label: None, - layout: Some(&pipeline_layout), - vertex: wgpu::VertexState { - module: &shader, - entry_point: "vs_main", - buffers: &[], - }, - fragment: Some(wgpu::FragmentState { - module: &shader, - entry_point: "fs_main", - targets: &[Some(swapchain_format.into())], - }), - primitive: wgpu::PrimitiveState::default(), - depth_stencil: None, - multisample: wgpu::MultisampleState::default(), - multiview: None, - }); + screen_stack.render(); + screen_stack.update(); - let mut config = wgpu::SurfaceConfiguration { - usage: wgpu::TextureUsages::RENDER_ATTACHMENT, - format: swapchain_format, - width: size.width, - height: size.height, - present_mode: wgpu::PresentMode::Fifo, - alpha_mode: surface.get_supported_alpha_modes(&adapter)[0], - }; + next_frame().await + } - surface.configure(&device, &config); - - event_loop.run(move |event, _, control_flow| { - // Have the closure take ownership of the resources. - // `event_loop.run` never returns, therefore we must do this to ensure - // the resources are properly cleaned up. - let _ = (&instance, &adapter, &shader, &pipeline_layout); - - *control_flow = ControlFlow::Wait; - match event { - Event::WindowEvent { - event: WindowEvent::Resized(size), - .. - } => { - // Reconfigure the surface with the new size - config.width = size.width; - config.height = size.height; - surface.configure(&device, &config); - // On macos the window needs to be redrawn manually after resizing - window.request_redraw(); - } - Event::RedrawRequested(_) => { - let frame = surface - .get_current_texture() - .expect("Failed to acquire next swap chain texture"); - let view = frame - .texture - .create_view(&wgpu::TextureViewDescriptor::default()); - let mut encoder = - device.create_command_encoder(&wgpu::CommandEncoderDescriptor { label: None }); - { - let mut rpass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - label: None, - color_attachments: &[Some(wgpu::RenderPassColorAttachment { - view: &view, - resolve_target: None, - ops: wgpu::Operations { - load: wgpu::LoadOp::Clear(wgpu::Color::GREEN), - store: true, - }, - })], - depth_stencil_attachment: None, - }); - rpass.set_pipeline(&render_pipeline); - rpass.draw(0..3, 0..1); - } - - queue.submit(Some(encoder.finish())); - frame.present(); - } - Event::WindowEvent { - event: WindowEvent::CloseRequested, - .. - } => *control_flow = ControlFlow::Exit, - _ => {} - } - }); -} - -fn main() { - let event_loop = EventLoop::new(); - let window = winit::window::Window::new(&event_loop).unwrap(); - - #[cfg(not(target_arch = "wasm32"))] - { - env_logger::init(); - // Temporarily avoid srgb formats for the swapchain on the web - pollster::block_on(run(event_loop, window)); - } - - #[cfg(target_arch = "wasm32")] - { - std::panic::set_hook(Box::new(console_error_panic_hook::hook)); - console_log::init().expect("could not initialize logger"); - use winit::platform::web::WindowExtWebSys; - // On wasm, append the canvas to the document body - web_sys::window() - .and_then(|win| win.document()) - .and_then(|doc| doc.body()) - .and_then(|body| { - body.append_child(&web_sys::Element::from(window.canvas())) - .ok() - }) - .expect("couldn't append canvas to document body"); - wasm_bindgen_futures::spawn_local(run(event_loop, window)); - } + Ok(()) } diff --git a/src/screens/menu.rs b/src/screens/menu.rs new file mode 100644 index 0000000..6650d59 --- /dev/null +++ b/src/screens/menu.rs @@ -0,0 +1,27 @@ +use macroquad::{input::is_key_pressed, miniquad::KeyCode}; + +// use crate::keymap::Keymap; +use crate::screens::{PlayScreen, Screen, ScreenAction}; + +pub struct MenuScreen; + +impl Screen for MenuScreen { + fn status(&self) -> String { + format!("menu screen") + } + + fn update(&mut self) -> ScreenAction { + if is_key_pressed(KeyCode::Space) { + let play_screen = PlayScreen::new(); + ScreenAction::Push(Box::new(play_screen)) + } else { + ScreenAction::None + } + } +} + +impl MenuScreen { + pub fn new() -> MenuScreen { + MenuScreen + } +} diff --git a/src/screens/mod.rs b/src/screens/mod.rs new file mode 100644 index 0000000..34df766 --- /dev/null +++ b/src/screens/mod.rs @@ -0,0 +1,59 @@ +mod menu; +mod play; + +pub use self::menu::MenuScreen; +pub use self::play::PlayScreen; + +pub trait Screen { + fn status(&self) -> String; + + fn update(&mut self) -> ScreenAction { + ScreenAction::None + } + + fn render(&self) {} +} + +pub enum ScreenAction { + None, + Push(Box), +} + +pub struct ScreenStack(Vec>); + +impl ScreenStack { + pub fn with(screen: S) -> Self { + let mut stack = Vec::>::new(); + stack.push(Box::new(screen)); + ScreenStack(stack) + } + + pub fn top(&self) -> impl AsRef + '_ { + self.0.last().unwrap() + } + + pub fn top_mut(&mut self) -> impl AsMut + '_ { + self.0.last_mut().unwrap() + } + + pub fn update(&mut self) { + let result = { + let mut screen = self.top_mut(); + let screen = screen.as_mut(); + screen.update() + }; + match result { + ScreenAction::None => (), + ScreenAction::Push(new_screen) => { + println!("pushed new screen"); + self.0.push(new_screen); + } + } + } + + pub fn render(&self) { + let screen = self.top(); + let screen = screen.as_ref(); + screen.render() + } +} diff --git a/src/screens/play.rs b/src/screens/play.rs new file mode 100644 index 0000000..fb2327c --- /dev/null +++ b/src/screens/play.rs @@ -0,0 +1,136 @@ +use std::time::Duration; + +use macroquad::{ + input::is_key_pressed, miniquad::KeyCode, time::get_frame_time, +}; + +use crate::{ + animations::AnimationState, + game_state::{Board, LevelData, LevelState, PushDir}, + screens::{Screen, ScreenAction}, +}; + +const LEVEL_TUTORIAL: &str = include_str!("../../levels/tutorial.json"); +const LEVEL_TUTORIAL2: &str = include_str!("../../levels/tutorial2.json"); +const LEVEL_1: &str = include_str!("../../levels/level1.json"); + +pub struct PlayScreen { + animations: AnimationState, + levels: Vec<&'static str>, + current_level: LevelState, + current_level_idx: usize, +} + +impl Screen for PlayScreen { + fn status(&self) -> String { + format!("play screen") + } + + fn update(&mut self) -> ScreenAction { + macro_rules! btn_handler { + ($key:expr, $board:expr, $direction:expr) => { + if is_key_pressed($key) { + println!("pushed: {:?}", $key); + let level = self.get_current_level_mut(); + let result = level.try_move($board, $direction); + self.animations.begin_move_transition(result); + } + }; + } + + if self.animations.is_animating { + let delta = Duration::from_secs_f32(get_frame_time()); + self.animations.make_progress(delta); + + // we just finished! + if !self.animations.is_animating { + // apply the changes to the entities + // this indirection is used to dodge a concurrent borrow + let change_set = + if let Some(Ok(change_set)) = &self.animations.last_move_result { + Some(change_set.clone()) + } else { + None + }; + if let Some(change_set) = change_set { + let level = self.get_current_level_mut(); + level.apply_change_set(change_set.clone()); + self.check_win_condition(); + } + } + } else { + btn_handler!(KeyCode::W, Board::Left, PushDir::Up); + btn_handler!(KeyCode::A, Board::Left, PushDir::Left); + btn_handler!(KeyCode::S, Board::Left, PushDir::Down); + btn_handler!(KeyCode::D, Board::Left, PushDir::Right); + + btn_handler!(KeyCode::I, Board::Right, PushDir::Up); + btn_handler!(KeyCode::J, Board::Right, PushDir::Left); + btn_handler!(KeyCode::K, Board::Right, PushDir::Down); + btn_handler!(KeyCode::L, Board::Right, PushDir::Right); + + if is_key_pressed(KeyCode::R) { + // restart the level + self.restart_level(); + } + } + + ScreenAction::None + } + + fn render(&self) { + let level = self.get_current_level(); + level.render(&self.animations); + } +} + +impl PlayScreen { + pub fn get_current_level(&self) -> &LevelState { + &self.current_level + } + + pub fn get_current_level_mut(&mut self) -> &mut LevelState { + &mut self.current_level + } + + pub fn new() -> PlayScreen { + let levels = vec![LEVEL_TUTORIAL, LEVEL_TUTORIAL2, LEVEL_1]; + + PlayScreen { + levels, + current_level: LevelState::new( + LevelData::load_from_string(&LEVEL_TUTORIAL).unwrap(), + ), + current_level_idx: 0, + animations: AnimationState::new(), + } + } + + fn restart_level(&mut self) { + self.switch_to_level(self.current_level_idx); + } + + fn switch_to_level(&mut self, idx: usize) { + self.current_level = + LevelState::new(LevelData::load_from_string(&self.levels[idx]).unwrap()); + self.current_level_idx = idx; + } + + fn go_to_next_level(&mut self) { + // TODO: make an actual win screen + let next_level = if self.current_level_idx + 1 >= self.levels.len() { + 0 + } else { + self.current_level_idx + 1 + }; + self.switch_to_level(next_level); + } + + fn check_win_condition(&mut self) { + let level = self.get_current_level(); + if level.check_win_condition() { + // go on to the next level + self.go_to_next_level(); + } + } +} diff --git a/src/shader.wgsl b/src/shader.wgsl deleted file mode 100644 index f84ccfe..0000000 --- a/src/shader.wgsl +++ /dev/null @@ -1,11 +0,0 @@ -@vertex -fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) vec4 { - let x = f32(i32(in_vertex_index) - 1); - let y = f32(i32(in_vertex_index & 1u) * 2 - 1); - return vec4(x, y, 0.0, 1.0); -} - -@fragment -fn fs_main() -> @location(0) vec4 { - return vec4(1.0, 0.0, 0.0, 1.0); -}