From f64869acce40d1a8280db1a2b8e89d12ef21a1ea Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 28 Oct 2021 01:01:22 -0400 Subject: [PATCH 1/5] everybody panic (just improper panic macro usages left) --- Cargo.lock | 1534 ++++++++++++++++++++++++--------------- Cargo.toml | 5 +- src/control.rs | 2 +- src/game.rs | 162 +++-- src/main.rs | 16 +- src/menu/choosemode.rs | 12 +- src/menu/inputconfig.rs | 31 +- src/menu/menuhelpers.rs | 28 +- src/menu/start.rs | 12 +- 9 files changed, 1072 insertions(+), 730 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0346b16..ce40c69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,21 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "ab_glyph" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af0ac006645f86f20f6c6fa4dcaef920bf803df819123626f9440e35835e7d80" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser 0.12.1", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9fe5e32de01730eb1f6b7f5b51c17e03e2325bf40a74f754f04f130043affff" + [[package]] name = "addr2line" version = "0.13.0" @@ -22,21 +38,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] -name = "alga" -version = "0.9.3" +name = "alsa" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f823d037a7ec6ea2197046bafd4ae150e6bc36f9ca347404f46a46823fa84f2" +checksum = "75c4da790adcb2ce5e758c064b4f3ec17a30349f9961d3e5e6c9688b052a9e18" dependencies = [ - "approx", - "num-complex", - "num-traits 0.2.12", + "alsa-sys", + "bitflags", + "libc", + "nix 0.20.2", ] [[package]] name = "alsa-sys" -version = "0.1.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0edcbbf9ef68f15ae1b620f722180b82a98b6f0628d30baa6b8d2a5abc87d58" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" dependencies = [ "libc", "pkg-config", @@ -44,13 +61,12 @@ dependencies = [ [[package]] name = "andrew" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7f09f89872c2b6b29e319377b1fbe91c6f5947df19a25596e121cf19a7b35e" +checksum = "8c4afb09dd642feec8408e33f92f3ffc4052946f6b20f32fb99c1f58cd4fa7cf" dependencies = [ "bitflags", - "line_drawing", - "rusttype 0.7.9", + "rusttype", "walkdir", "xdg", "xml-rs", @@ -64,26 +80,11 @@ checksum = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" [[package]] name = "approx" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3" -dependencies = [ - "num-traits 0.2.12", -] - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.4.12" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +checksum = "072df7202e63b127ab55acfe16ce97013d5b97bf160489336d3f1840fd78e99e" dependencies = [ - "nodrop", + "num-traits", ] [[package]] @@ -92,12 +93,6 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" -[[package]] -name = "autocfg" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" - [[package]] name = "autocfg" version = "1.0.1" @@ -111,9 +106,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f813291114c186a042350e787af10c26534601062603d888be110f59f85ef8fa" dependencies = [ "addr2line", - "cfg-if", + "cfg-if 0.1.10", "libc", - "miniz_oxide", + "miniz_oxide 0.4.3", "object", "rustc-demangle", ] @@ -124,12 +119,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1" -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - [[package]] name = "bindgen" version = "0.53.3" @@ -138,13 +127,13 @@ checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5" dependencies = [ "bitflags", "cexpr", - "cfg-if", + "cfg-if 0.1.10", "clang-sys", "lazy_static", "lazycell", "peeking_take_while", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "regex", "rustc-hash", "shlex", @@ -156,17 +145,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -[[package]] -name = "blake2b_simd" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" -dependencies = [ - "arrayref", - "arrayvec 0.5.1", - "constant_time_eq", -] - [[package]] name = "block" version = "0.1.6" @@ -185,12 +163,24 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b92204551573580e078dc80017f36a213eb77a0450e4ddd8cfa0f3f2d1f0178f" +[[package]] +name = "bytemuck" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72957246c41db82b8ef88a5486143830adeb8227ef9837740bdec67724cf2c5b" + [[package]] name = "byteorder" version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +[[package]] +name = "bytes" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" + [[package]] name = "bzip2" version = "0.3.3" @@ -212,6 +202,16 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "calloop" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b036167e76041694579972c28cf4877b4f92da222560ddb49008937b6a6727c" +dependencies = [ + "log", + "nix 0.18.0", +] + [[package]] name = "cargo_metadata" version = "0.6.4" @@ -230,6 +230,15 @@ name = "cc" version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" +dependencies = [ + "jobserver", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" [[package]] name = "cexpr" @@ -237,7 +246,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" dependencies = [ - "nom", + "nom 5.1.2", ] [[package]] @@ -246,13 +255,18 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + [[package]] name = "cgl" -version = "0.2.3" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e7ec0b74fe5897894cbc207092c577e87c52f8a59e8ca8d97ef37551f60a49" +checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff" dependencies = [ - "gleam", "libc", ] @@ -274,24 +288,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4bfbf56724aa9eca8afa4fcfadeb479e722935bb2a0900c2d37e0cc477af0688" [[package]] -name = "cloudabi" -version = "0.0.3" +name = "cocoa" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832" dependencies = [ "bitflags", + "block", + "cocoa-foundation", + "core-foundation 0.9.2", + "core-graphics 0.22.2", + "foreign-types", + "libc", + "objc", ] [[package]] -name = "cocoa" -version = "0.18.5" +name = "cocoa-foundation" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1706996401131526e36b3b49f0c4d912639ce110996f3ca144d78946727bce54" +checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" dependencies = [ "bitflags", "block", - "core-foundation", - "core-graphics", + "core-foundation 0.9.2", + "core-graphics-types", "foreign-types", "libc", "objc", @@ -304,10 +325,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] -name = "constant_time_eq" -version = "0.1.5" +name = "combine" +version = "4.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" +checksum = "a909e4d93292cd8e9c42e189f61681eff9d67b6541f96b8a1a737f23737bd001" +dependencies = [ + "bytes", + "memchr", +] [[package]] name = "core-foundation" @@ -315,7 +340,27 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.6.2", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +dependencies = [ + "core-foundation-sys 0.7.0", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" +dependencies = [ + "core-foundation-sys 0.8.3", "libc", ] @@ -325,23 +370,73 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +[[package]] +name = "core-foundation-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + +[[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.17.3" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" +dependencies = [ + "bitflags", + "core-foundation 0.7.0", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56790968ab1c8a1202a102e6de05fc6e1ec87da99e4e93e9a7d13efbfc1e95a9" +checksum = "269f35f69b542b80e736a20a89a05215c0ce80c2c03c514abb2e318b78379d86" dependencies = [ "bitflags", - "core-foundation", + "core-foundation 0.9.2", + "core-graphics-types", "foreign-types", "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 0.9.2", + "foreign-types", + "libc", +] + +[[package]] +name = "core-video-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" +dependencies = [ + "cfg-if 0.1.10", + "core-foundation-sys 0.7.0", + "core-graphics 0.19.2", + "libc", + "objc", +] + [[package]] name = "coreaudio-rs" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f229761965dad3e9b11081668a6ea00f1def7aa46062321b5ec245b834f6e491" +checksum = "11894b20ebfe1ff903cbdc52259693389eea03b94918a2def2c30c3bf227ad88" dependencies = [ "bitflags", "coreaudio-sys", @@ -358,18 +453,26 @@ dependencies = [ [[package]] name = "cpal" -version = "0.11.0" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b55d55d69f403f62a95bd3c04b431e0aedf5120c70f15d07a8edd234443dd59" +checksum = "98f45f0a21f617cd2c788889ef710b63f075c949259593ea09c826f1e47a2418" dependencies = [ - "alsa-sys", - "core-foundation-sys", + "alsa", + "core-foundation-sys 0.8.3", "coreaudio-rs", + "jni 0.19.0", + "js-sys", "lazy_static", "libc", - "num-traits 0.2.12", + "mach 0.3.2", + "ndk", + "ndk-glue", + "nix 0.20.2", + "oboe", + "parking_lot", "stdweb 0.1.3", "thiserror", + "web-sys", "winapi", ] @@ -379,71 +482,147 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", +] + +[[package]] +name = "crossbeam" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.7.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" +checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" dependencies = [ + "cfg-if 1.0.0", "crossbeam-epoch", "crossbeam-utils", - "maybe-uninit", ] [[package]] name = "crossbeam-epoch" -version = "0.8.2" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" dependencies = [ - "autocfg 1.0.1", - "cfg-if", + "cfg-if 1.0.0", "crossbeam-utils", "lazy_static", - "maybe-uninit", "memoffset", "scopeguard", ] +[[package]] +name = "crossbeam-queue" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b10ddc024425c88c2ad148c1b0fd53f4c6d38db9697c9f1588381212fa657c9" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" -version = "0.7.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" dependencies = [ - "autocfg 1.0.1", - "cfg-if", + "cfg-if 1.0.0", "lazy_static", ] +[[package]] +name = "darling" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +dependencies = [ + "darling_core", + "quote", + "syn", +] + [[package]] name = "deflate" -version = "0.7.20" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" +checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" dependencies = [ "adler32", "byteorder", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "directories" -version = "2.0.2" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551a778172a450d7fc12e629ca3b0428d00f6afa9a43da1b630d54604e97371c" +checksum = "e69600ff1703123957937708eb27f7a564e48885c537782722ed0ba3189ce1d7" dependencies = [ - "cfg-if", "dirs-sys", ] [[package]] name = "dirs-sys" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" +checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" dependencies = [ "libc", "redox_users", @@ -456,6 +635,12 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + [[package]] name = "dlib" version = "0.4.2" @@ -465,6 +650,15 @@ dependencies = [ "libloading 0.6.4", ] +[[package]] +name = "dlib" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" +dependencies = [ + "libloading 0.7.1", +] + [[package]] name = "downcast-rs" version = "1.2.0" @@ -480,6 +674,12 @@ dependencies = [ "bitflags", ] +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + [[package]] name = "error-chain" version = "0.12.4" @@ -492,23 +692,20 @@ dependencies = [ [[package]] name = "euclid" -version = "0.19.9" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "596b99621b9477e7a5f94d2d8dd13a9c5c302ac358b822c67a42b6f1054450e1" +checksum = "da96828553a086d7b18dcebfc579bd9628b016f86590d7453c115e490fa74b80" dependencies = [ - "euclid_macros", - "num-traits 0.2.12", + "num-traits", ] [[package]] -name = "euclid_macros" -version = "0.1.0" +name = "float_next_after" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdcb84c18ea5037a1c5a23039b4ff29403abce2e0d6b1daa11cf0bde2b30be15" +checksum = "4fc612c5837986b7104a87a0df74a5460931f1c5274be12f8d0f40aa2f30d632" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", + "num-traits", ] [[package]] @@ -539,23 +736,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] -name = "generic-array" -version = "0.12.3" +name = "getrandom" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" dependencies = [ - "typenum", + "cfg-if 0.1.10", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", ] [[package]] name = "getrandom" -version = "0.1.15" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "libc", - "wasi", + "wasi 0.10.2+wasi-snapshot-preview1", ] [[package]] @@ -597,40 +796,31 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2d38164670920cfb7491bc0cf6f49f0554bd1c44cdbedc6c78d2bf91691ff5e" dependencies = [ - "gl_generator 0.14.0", -] - -[[package]] -name = "gfx_window_glutin" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f415d3534e6ea92f3ded1683e9e00592a76e2e67050e33244bb507719a211eb2" -dependencies = [ - "gfx_core", - "gfx_device_gl", - "glutin", + "gl_generator", ] [[package]] name = "ggez" -version = "0.5.1" -source = "git+https://github.com/Brian-Catcow-B/ggez.git?branch=master-custom-gamepads#d323fd71d5da56c887c594536803dbe0807b6ef1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e11175a3fc1e377f57b14394a912c05970d8f679e3340e81663778a9a14b0b4" dependencies = [ "approx", "bitflags", + "bytemuck", "directories", "gfx", "gfx_core", "gfx_device_gl", - "gfx_window_glutin", "gilrs", + "glam 0.17.3", "glutin", - "glyph_brush 0.5.4", + "glyph_brush", "image", "log", "lyon", "mint", - "nalgebra", + "old_school_gfx_glutin_ext", "rodio", "serde", "serde_derive", @@ -643,40 +833,39 @@ dependencies = [ [[package]] name = "gif" -version = "0.10.3" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "471d90201b3b223f3451cd4ad53e34295f16a1df17b1edf3736d47761c3981af" +checksum = "c3a7187e78088aead22ceedeee99779455b23fc231fe13ec443f99bb71694e5b" dependencies = [ "color_quant", - "lzw", + "weezl", ] [[package]] name = "gilrs" -version = "0.7.4" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122bb249f904e5f4ac73fc514b9b2ce6cce3af511f5df00ffc8000e47de6b290" +checksum = "0e986f911d937f4395dfc2a39618dcef452773d32dcdbe0828c623f76588f749" dependencies = [ "fnv", "gilrs-core", "log", - "stdweb 0.4.20", "uuid", "vec_map", ] [[package]] name = "gilrs-core" -version = "0.2.6" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43c758daf46af26d6872fe55507e3b2339779a160a06ad7a9b2a082f221209cd" +checksum = "9a5e5bb97bf9a0d9519a28cf38839cf1d6d9bb572b48e3c67202271fec2ed5e7" dependencies = [ - "core-foundation", + "core-foundation 0.6.4", "io-kit-sys", "libc", "libudev-sys", "log", - "nix 0.15.0", + "nix 0.20.2", "rusty-xinput", "stdweb 0.4.20", "uuid", @@ -692,9 +881,9 @@ checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" [[package]] name = "gl_generator" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca98bbde17256e02d17336a6bdb5a50f7d0ccacee502e191d3e3d0ec2f96f84a" +checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" dependencies = [ "khronos_api", "log", @@ -702,24 +891,19 @@ dependencies = [ ] [[package]] -name = "gl_generator" -version = "0.14.0" +name = "glam" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d" +checksum = "e01732b97afd8508eee3333a541b9f7610f454bb818669e66e90f5f57c93a776" dependencies = [ - "khronos_api", - "log", - "xml-rs", + "mint", ] [[package]] -name = "gleam" -version = "0.6.19" +name = "glam" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae10d7c99d0e77b4766e850a60898a17c1abaf01075531f1066f03dc7dc5fc5" -dependencies = [ - "gl_generator 0.13.1", -] +checksum = "2b8509e6791516e81c1a630d0bd7fbac36d2fa8712a9da8662e716b52d5051ca" [[package]] name = "glob" @@ -735,26 +919,27 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "glutin" -version = "0.20.1" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5cc17ac6cb35704f434faaa5bb5e4254a66f50853976c7e6f00aee09ff1bf2" +checksum = "762d6cd2e1b855d99668ebe591cc9058659d85ac39a9a2078000eb122ddba8f0" dependencies = [ "android_glue", "cgl", "cocoa", - "core-foundation", - "core-graphics", + "core-foundation 0.9.2", "glutin_egl_sys", + "glutin_emscripten_sys", "glutin_gles2_sys", "glutin_glx_sys", "glutin_wgl_sys", "lazy_static", - "libc", - "libloading 0.5.2", + "libloading 0.7.1", + "log", "objc", "osmesa-sys", - "shared_library", + "parking_lot", "wayland-client", + "wayland-egl", "winapi", "winit", ] @@ -765,17 +950,23 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2abb6aa55523480c4adc5a56bbaa249992e2dddb2fc63dc96e04a3355364c211" dependencies = [ - "gl_generator 0.14.0", + "gl_generator", "winapi", ] +[[package]] +name = "glutin_emscripten_sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80de4146df76e8a6c32b03007bc764ff3249dcaeb4f675d68a06caf1bac363f1" + [[package]] name = "glutin_gles2_sys" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8094e708b730a7c8a1954f4f8a31880af00eb8a1c5b5bf85d28a0a3c6d69103" dependencies = [ - "gl_generator 0.14.0", + "gl_generator", "objc", ] @@ -785,7 +976,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e393c8fc02b807459410429150e9c4faffdb312d59b8c038566173c81991351" dependencies = [ - "gl_generator 0.14.0", + "gl_generator", "x11-dl", ] @@ -795,40 +986,45 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3da5951a1569dbab865c6f2a863efafff193a93caf05538d193e9e3816d21696" dependencies = [ - "gl_generator 0.14.0", + "gl_generator", ] [[package]] name = "glyph_brush" -version = "0.5.4" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "131d7d6f3e7ea0988a707da50ae876f8a9c4c7eb397ccfac9fe9309d4ebe8726" +checksum = "3e3f00b8574a76fb6c50890c48da03946ca50e4372a2778737922666a2238221" dependencies = [ - "glyph_brush 0.6.3", + "glyph_brush_draw_cache", + "glyph_brush_layout", + "log", + "ordered-float", + "rustc-hash", + "twox-hash", ] [[package]] -name = "glyph_brush" -version = "0.6.3" +name = "glyph_brush_draw_cache" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fca6f9d679bff1322c76c9a1ad4b8553b30a94f3f75bea6936e19032c2f2ec3" +checksum = "ac2c82074cafb68b9e459c50c655f7eedcb92d6ee7166813802934bc6fc29fa3" dependencies = [ - "glyph_brush_layout", - "log", - "ordered-float", + "ab_glyph", + "crossbeam-channel", + "crossbeam-deque", + "linked-hash-map", + "rayon", "rustc-hash", - "rusttype 0.8.3", - "twox-hash", ] [[package]] name = "glyph_brush_layout" -version = "0.1.9" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b70adc570f1dc71b6b32e241cbcc2b42175f5aea71951fbf41e68b04aec24c7" +checksum = "cc32c2334f00ca5ac3695c5009ae35da21da8c62d255b5b96d56e2597a637a38" dependencies = [ + "ab_glyph", "approx", - "rusttype 0.8.3", "xi-unicode", ] @@ -847,29 +1043,36 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549" +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "image" -version = "0.22.5" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08ed2ada878397b045454ac7cfb011d73132c59f31a955d230bd1f1c2e68eb4a" +checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1" dependencies = [ + "bytemuck", "byteorder", + "color_quant", "gif", - "jpeg-decoder", "num-iter", "num-rational", - "num-traits 0.2.12", + "num-traits", "png", "tiff", ] [[package]] -name = "inflate" -version = "0.4.5" +name = "instant" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "adler32", + "cfg-if 1.0.0", ] [[package]] @@ -878,7 +1081,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f21dcc74995dd4cd090b147e79789f8d65959cbfb5f0b118002db869ea3bd0a0" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.6.2", "mach 0.2.3", ] @@ -888,6 +1091,49 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +[[package]] +name = "jni" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24967112a1e4301ca5342ea339763613a37592b8a6ce6cf2e4494537c7a42faf" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +dependencies = [ + "libc", +] + [[package]] name = "jpeg-decoder" version = "0.1.20" @@ -897,6 +1143,15 @@ dependencies = [ "byteorder", ] +[[package]] +name = "js-sys" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "khronos_api" version = "3.1.0" @@ -928,9 +1183,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.79" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" +checksum = "869d572136620d55835903746bcb5cdc54cb2851fd0aeec53220b4bb65ef3013" [[package]] name = "libloading" @@ -948,15 +1203,19 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3557c9384f7f757f6d139cd3a4c62ef4e850696c16bf27924a5538c8a09717a1" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", "winapi", ] [[package]] -name = "libm" -version = "0.2.1" +name = "libloading" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" +checksum = "c0cf036d15402bea3c5d4de17b3fce76b3e4a56ebc1f577be0e7a72f7c607cf0" +dependencies = [ + "cfg-if 1.0.0", + "winapi", +] [[package]] name = "libudev-sys" @@ -968,15 +1227,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "line_drawing" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc7ad3d82c845bdb5dde34ffdcc7a5fb4d2996e1e1ee0f19c33bc80e15196b9" -dependencies = [ - "num-traits 0.2.12", -] - [[package]] name = "linked-hash-map" version = "0.5.3" @@ -985,9 +1235,9 @@ checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" [[package]] name = "lock_api" -version = "0.3.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" dependencies = [ "scopeguard", ] @@ -998,14 +1248,14 @@ version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ - "cfg-if", + "cfg-if 0.1.10", ] [[package]] name = "lyon" -version = "0.13.5" +version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcbe51099b21e92413cd1f692ba6f0140007d1b01ca07e703172d88d45096c9a" +checksum = "cf0510ed5e3e2fb80f3db2061ef5ca92d87bfda1a624bb1eacf3bd50226e4cbb" dependencies = [ "lyon_algorithms", "lyon_tessellation", @@ -1013,9 +1263,9 @@ dependencies = [ [[package]] name = "lyon_algorithms" -version = "0.13.4" +version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5acff42f708e6d2d4126c7aee8c4711c08e9be6143f0d6050498fafb7f4a0287" +checksum = "3455481f62077255e4837ba768d662e17ba80ef9fbf07bc038a5d9796d903f57" dependencies = [ "lyon_path", "sid", @@ -1023,40 +1273,34 @@ dependencies = [ [[package]] name = "lyon_geom" -version = "0.12.7" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb9bf1f1d43be9a9cc2343a7a096dc113cc25337a13e8f99721b01d1d548b60" +checksum = "fe153a6ce93cb97c85ba47a007fd437079bbff5592b9c0f77195973b8b169d69" dependencies = [ - "arrayvec 0.4.12", + "arrayvec", "euclid", - "num-traits 0.2.12", + "num-traits", ] [[package]] name = "lyon_path" -version = "0.13.2" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd492548d32f7e8de10509953ed56d11dbc7103c36d56f32f3b74bf72b04cf29" +checksum = "5b0a59fdf767ca0d887aa61d1b48d4bbf6a124c1a45503593f7d38ab945bfbc0" dependencies = [ "lyon_geom", ] [[package]] name = "lyon_tessellation" -version = "0.13.5" +version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "228f5eedeb6795b57d22fa91f6c215643f2c2aae758f9432585c8d99b7be9143" +checksum = "7230e08dd0638048e46f387f255dbe7a7344a3e6705beab53242b5af25635760" dependencies = [ + "float_next_after", "lyon_path", - "sid", ] -[[package]] -name = "lzw" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" - [[package]] name = "mach" version = "0.2.3" @@ -1084,15 +1328,6 @@ dependencies = [ "libc", ] -[[package]] -name = "matrixmultiply" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4f7ec66360130972f34830bfad9ef05c6610a43938a467bcc9ab9369ab3478f" -dependencies = [ - "rawpointer", -] - [[package]] name = "maybe-uninit" version = "2.0.0" @@ -1106,32 +1341,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] -name = "memmap" -version = "0.7.0" +name = "memmap2" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" +checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a" dependencies = [ "libc", - "winapi", ] [[package]] name = "memoffset" -version = "0.5.6" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" dependencies = [ - "autocfg 1.0.1", + "autocfg", ] +[[package]] +name = "minimal-lexical" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c64630dcdd71f1a64c435f54885086a0de5d6a12d104d69b165fb7d5286d677" + [[package]] name = "minimp3" -version = "0.3.5" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce0cff6a0bfd3f8b6b2350819bbddd63bc65cc45e53888bdd0ff49dde16d2d5" +checksum = "985438f75febf74c392071a975a29641b420dd84431135a6e6db721de4b74372" dependencies = [ "minimp3-sys", "slice-deque", + "thiserror", ] [[package]] @@ -1143,6 +1384,15 @@ dependencies = [ "cc", ] +[[package]] +name = "miniz_oxide" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" +dependencies = [ + "adler32", +] + [[package]] name = "miniz_oxide" version = "0.4.3" @@ -1150,7 +1400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" dependencies = [ "adler", - "autocfg 1.0.1", + "autocfg", ] [[package]] @@ -1160,84 +1410,148 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d42e54f364a39ad5238e3072db2e8747785b37655368da756987d3b09ada91e0" [[package]] -name = "nalgebra" -version = "0.18.1" +name = "mio" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaa9fddbc34c8c35dd2108515587b8ce0cab396f17977b8c738568e4edb521a2" +checksum = "8067b404fe97c70829f082dec8bcf4f71225d7eaea1d8645349cb76fa06205cc" dependencies = [ - "alga", - "approx", - "generic-array", - "matrixmultiply", - "mint", - "num-complex", - "num-rational", - "num-traits 0.2.12", - "rand 0.6.5", - "typenum", + "libc", + "log", + "miow", + "ntapi", + "winapi", ] +[[package]] +name = "mio-misc" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ddf05411bb159cdb5801bb10002afb66cb4572be656044315e363460ce69dc2" +dependencies = [ + "crossbeam", + "crossbeam-queue", + "log", + "mio", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "ndk" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8794322172319b972f528bf90c6b467be0079f1fa82780ffb431088e741a73ab" +dependencies = [ + "jni-sys", + "ndk-sys", + "num_enum", + "thiserror", +] + +[[package]] +name = "ndk-glue" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5caf0c24d51ac1c905c27d4eda4fa0635bbe0de596b8f79235e0b17a4d29385" +dependencies = [ + "lazy_static", + "libc", + "log", + "ndk", + "ndk-macro", + "ndk-sys", +] + +[[package]] +name = "ndk-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" +dependencies = [ + "darling", + "proc-macro-crate 0.1.5", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ndk-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" + [[package]] name = "nix" -version = "0.14.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c722bee1037d430d0f8e687bbdbf222f27cc6e4e68d5caf630857bb2b6dbdce" +checksum = "83450fe6a6142ddd95fb064b746083fc4ef1705fe81f64a64e1d4b39f54a1055" dependencies = [ "bitflags", "cc", - "cfg-if", + "cfg-if 0.1.10", "libc", - "void", ] [[package]] name = "nix" -version = "0.15.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2e0b4f3320ed72aaedb9a5ac838690a8047c7b275da22711fddff4f8a14229" +checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945" dependencies = [ "bitflags", "cc", - "cfg-if", + "cfg-if 1.0.0", "libc", - "void", + "memoffset", ] [[package]] -name = "nodrop" -version = "0.1.14" +name = "nom" +version = "5.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" +checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" +dependencies = [ + "memchr", + "version_check", +] [[package]] name = "nom" -version = "5.1.2" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" +checksum = "7ffd9d26838a953b4af82cbeb9f1592c6798916983959be223a7124e992742c1" dependencies = [ "memchr", + "minimal-lexical", "version_check", ] [[package]] -name = "num-complex" -version = "0.2.4" +name = "ntapi" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "autocfg 1.0.1", - "num-traits 0.2.12", + "winapi", ] [[package]] name = "num-derive" -version = "0.2.5" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1246,8 +1560,8 @@ version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" dependencies = [ - "autocfg 1.0.1", - "num-traits 0.2.12", + "autocfg", + "num-traits", ] [[package]] @@ -1256,49 +1570,61 @@ version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f" dependencies = [ - "autocfg 1.0.1", + "autocfg", "num-integer", - "num-traits 0.2.12", + "num-traits", ] [[package]] name = "num-rational" -version = "0.2.4" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ - "autocfg 1.0.1", + "autocfg", "num-integer", - "num-traits 0.2.12", + "num-traits", ] [[package]] name = "num-traits" -version = "0.1.43" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" dependencies = [ - "num-traits 0.2.12", + "hermit-abi", + "libc", ] [[package]] -name = "num-traits" -version = "0.2.12" +name = "num_enum" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +checksum = "3f9bd055fb730c4f8f4f57d45d35cd6b3f0980535b056dc7ff119cee6a66ed6f" dependencies = [ - "autocfg 1.0.1", - "libm", + "derivative", + "num_enum_derive", ] [[package]] -name = "num_cpus" -version = "1.13.0" +name = "num_enum_derive" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9" dependencies = [ - "hermit-abi", - "libc", + "proc-macro-crate 1.1.0", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1316,6 +1642,29 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" +[[package]] +name = "oboe" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa187b38ae20374617b7ad418034ed3dc90ac980181d211518bd03537ae8f8d" +dependencies = [ + "jni 0.18.0", + "ndk", + "ndk-glue", + "num-derive", + "num-traits", + "oboe-sys", +] + +[[package]] +name = "oboe-sys" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "338142ae5ab0aaedc8275aa8f67f460e43ae0fca76a695a742d56da0a269eadc" +dependencies = [ + "cc", +] + [[package]] name = "ogg" version = "0.7.0" @@ -1325,13 +1674,30 @@ dependencies = [ "byteorder", ] +[[package]] +name = "old_school_gfx_glutin_ext" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1026bdd085523158bd5a1cf0ccbf39b7753c96ccbd54e7f6144ed1518f0046b3" +dependencies = [ + "gfx_core", + "gfx_device_gl", + "glutin", +] + +[[package]] +name = "once_cell" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" + [[package]] name = "ordered-float" -version = "1.1.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3741934be594d77de1c8461ebcbbe866f585ea616a9753aa78f2bdc69f0e4579" +checksum = "97c9d06878b3a851e8026ef94bf7fef9ba93062cd412601da4d9cf369b1cc62d" dependencies = [ - "num-traits 0.2.12", + "num-traits", ] [[package]] @@ -1343,28 +1709,45 @@ dependencies = [ "shared_library", ] +[[package]] +name = "owned_ttf_parser" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f923fb806c46266c02ab4a5b239735c144bdeda724a50ed058e5226f594cde3" +dependencies = [ + "ttf-parser 0.6.2", +] + +[[package]] +name = "owned_ttf_parser" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60ac8dda2e5cc09bf6480e3b3feff9783db251710c922ae9369a429c51efdeb0" +dependencies = [ + "ttf-parser 0.12.3", +] + [[package]] name = "parking_lot" -version = "0.9.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ + "instant", "lock_api", "parking_lot_core", - "rustc_version", ] [[package]] name = "parking_lot_core" -version = "0.6.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "cfg-if", - "cloudabi", + "cfg-if 1.0.0", + "instant", "libc", "redox_syscall", - "rustc_version", "smallvec", "winapi", ] @@ -1389,14 +1772,14 @@ checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" [[package]] name = "png" -version = "0.15.3" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef859a23054bbfee7811284275ae522f0434a3c8e7f4b74bd4a35ae7e1c4a283" +checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" dependencies = [ "bitflags", "crc32fast", "deflate", - "inflate", + "miniz_oxide 0.3.7", ] [[package]] @@ -1406,48 +1789,49 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" [[package]] -name = "proc-macro2" -version = "0.4.30" +name = "proc-macro-crate" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" dependencies = [ - "unicode-xid 0.1.0", + "toml", ] [[package]] -name = "proc-macro2" -version = "1.0.24" +name = "proc-macro-crate" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83" dependencies = [ - "unicode-xid 0.2.1", + "thiserror", + "toml", ] [[package]] -name = "pulldown-cmark" -version = "0.2.0" +name = "proc-macro2" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eef52fac62d0ea7b9b4dc7da092aa64ea7ec3d90af6679422d3d7e0e14b6ee15" +checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" dependencies = [ - "bitflags", + "unicode-xid", ] [[package]] -name = "quote" -version = "0.6.13" +name = "pulldown-cmark" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +checksum = "eef52fac62d0ea7b9b4dc7da092aa64ea7ec3d90af6679422d3d7e0e14b6ee15" dependencies = [ - "proc-macro2 0.4.30", + "bitflags", ] [[package]] name = "quote" -version = "1.0.7" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" dependencies = [ - "proc-macro2 1.0.24", + "proc-macro2", ] [[package]] @@ -1463,46 +1847,17 @@ dependencies = [ "winapi", ] -[[package]] -name = "rand" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" -dependencies = [ - "autocfg 0.1.7", - "libc", - "rand_chacha 0.1.1", - "rand_core 0.4.2", - "rand_hc 0.1.0", - "rand_isaac", - "rand_jitter", - "rand_os", - "rand_pcg", - "rand_xorshift", - "winapi", -] - [[package]] name = "rand" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.15", "libc", - "rand_chacha 0.2.2", + "rand_chacha", "rand_core 0.5.1", - "rand_hc 0.2.0", -] - -[[package]] -name = "rand_chacha" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.3.1", + "rand_hc", ] [[package]] @@ -1536,16 +1891,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" -dependencies = [ - "rand_core 0.3.1", + "getrandom 0.1.15", ] [[package]] @@ -1558,73 +1904,39 @@ dependencies = [ ] [[package]] -name = "rand_isaac" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -dependencies = [ - "rand_core 0.3.1", -] - -[[package]] -name = "rand_jitter" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" -dependencies = [ - "libc", - "rand_core 0.4.2", - "winapi", -] - -[[package]] -name = "rand_os" -version = "0.1.3" +name = "raw-window-handle" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +checksum = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211" dependencies = [ - "cloudabi", - "fuchsia-cprng", "libc", - "rand_core 0.4.2", - "rdrand", - "winapi", -] - -[[package]] -name = "rand_pcg" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" -dependencies = [ - "autocfg 0.1.7", - "rand_core 0.4.2", ] [[package]] -name = "rand_xorshift" -version = "0.1.1" +name = "rayon" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" dependencies = [ - "rand_core 0.3.1", + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", ] [[package]] -name = "raw-window-handle" -version = "0.3.3" +name = "rayon-core" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211" +checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" dependencies = [ - "libc", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", ] -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - [[package]] name = "rdrand" version = "0.4.0" @@ -1636,19 +1948,21 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.57" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +dependencies = [ + "bitflags", +] [[package]] name = "redox_users" -version = "0.3.5" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" +checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ - "getrandom", + "getrandom 0.2.3", "redox_syscall", - "rust-argon2", ] [[package]] @@ -1677,30 +1991,17 @@ dependencies = [ [[package]] name = "rodio" -version = "0.11.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73bbf260262fd5501b7a17d6827e0d25c1127e921eb177150a060faf6e217a70" +checksum = "4d98f5e557b61525057e2bc142c8cd7f0e70d75dc32852309bec440e6e046bf9" dependencies = [ "claxon", "cpal", "hound", - "lazy_static", "lewton", "minimp3", ] -[[package]] -name = "rust-argon2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dab61250775933275e84053ac235621dfb739556d5c54a2f2e9313b7cf43a19" -dependencies = [ - "base64", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils", -] - [[package]] name = "rustc-demangle" version = "0.1.17" @@ -1724,27 +2025,12 @@ dependencies = [ [[package]] name = "rusttype" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310942406a39981bed7e12b09182a221a29e0990f3e7e0c971f131922ed135d5" -dependencies = [ - "rusttype 0.8.3", -] - -[[package]] -name = "rusttype" -version = "0.8.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f61411055101f7b60ecf1041d87fb74205fb20b0c7a723f07ef39174cf6b4c0" +checksum = "dc7c727aded0be18c5b80c1640eae0ac8e396abf6fa8477d96cb37d18ee5ec59" dependencies = [ - "approx", - "crossbeam-deque", - "crossbeam-utils", - "linked-hash-map", - "num_cpus", - "ordered-float", - "rustc-hash", - "stb_truetype", + "ab_glyph_rasterizer", + "owned_ttf_parser 0.6.0", ] [[package]] @@ -1773,6 +2059,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + [[package]] name = "scopeguard" version = "1.1.0" @@ -1807,9 +2099,9 @@ version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "syn 1.0.44", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1847,11 +2139,11 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "sid" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29e0a6006cf04d568a49363baca3dabddbbe46538f7c76692d405f5f5d140ecd" +checksum = "bd5ac56c121948b4879bba9e519852c211bcdd8f014efff766441deff0b91bdb" dependencies = [ - "num-traits 0.1.43", + "num-traits", ] [[package]] @@ -1883,50 +2175,40 @@ dependencies = [ [[package]] name = "smallvec" -version = "0.6.13" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" -dependencies = [ - "maybe-uninit", -] +checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" [[package]] name = "smart-default" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a9dbd5f03d04e80355cbbe3ce5cf1f65c421eac575402e3d4d6e95d5a44edaa" +checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "smithay-client-toolkit" -version = "0.4.6" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ccb8c57049b2a34d2cc2b203fa785020ba0129d31920ef0d317430adaf748fa" +checksum = "4750c76fd5d3ac95fa3ed80fe667d6a3d8590a960e5b575b98eea93339a80b80" dependencies = [ "andrew", "bitflags", - "dlib", + "calloop", + "dlib 0.4.2", "lazy_static", - "memmap", - "nix 0.14.1", + "log", + "memmap2", + "nix 0.18.0", "wayland-client", - "wayland-commons", + "wayland-cursor", "wayland-protocols", ] -[[package]] -name = "stb_truetype" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f77b6b07e862c66a9f3e62a07588fee67cd90a9135a2b942409f195507b4fb51" -dependencies = [ - "byteorder", -] - [[package]] name = "stdweb" version = "0.1.3" @@ -1955,11 +2237,11 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "serde", "serde_derive", - "syn 1.0.44", + "syn", ] [[package]] @@ -1969,13 +2251,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" dependencies = [ "base-x", - "proc-macro2 1.0.24", - "quote 1.0.7", + "proc-macro2", + "quote", "serde", "serde_derive", "serde_json", "sha1", - "syn 1.0.44", + "syn", ] [[package]] @@ -1985,25 +2267,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" [[package]] -name = "syn" -version = "0.15.44" +name = "strsim" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", -] +checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[package]] name = "syn" -version = "1.0.44" +version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e03e57e4fcbfe7749842d53e24ccb9aa12b7252dbe5e91d2acad31834c8b8fdd" +checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "unicode-xid 0.2.1", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] @@ -2021,40 +2298,39 @@ name = "tetrisn-t" version = "0.1.0" dependencies = [ "ggez", - "gilrs", + "glam 0.19.0", "rand 0.7.3", ] [[package]] name = "thiserror" -version = "1.0.21" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42" +checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.21" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab" +checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "syn 1.0.44", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "tiff" -version = "0.3.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7b7c2cfc4742bd8a32f2e614339dd8ce30dbcf676bb262bd63a2327bc5df57d" +checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437" dependencies = [ - "byteorder", - "lzw", - "num-derive", - "num-traits 0.2.12", + "jpeg-decoder", + "miniz_oxide 0.4.3", + "weezl", ] [[package]] @@ -2073,25 +2349,25 @@ dependencies = [ ] [[package]] -name = "twox-hash" -version = "1.5.0" +name = "ttf-parser" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bfd5b7557925ce778ff9b9ef90e3ade34c524b5ff10e239c69a42d546d2af56" -dependencies = [ - "rand 0.7.3", -] +checksum = "3e5d7cd7ab3e47dda6e56542f4bbf3824c15234958c6e1bd6aaa347e93499fdc" [[package]] -name = "typenum" -version = "1.12.0" +name = "ttf-parser" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" +checksum = "7ae2f58a822f08abdaf668897e96a5656fe72f5a9ce66422423e8849384872e6" [[package]] -name = "unicode-xid" -version = "0.1.0" +name = "twox-hash" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +checksum = "3bfd5b7557925ce778ff9b9ef90e3ade34c524b5ff10e239c69a42d546d2af56" +dependencies = [ + "rand 0.7.3", +] [[package]] name = "unicode-xid" @@ -2117,12 +2393,6 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" - [[package]] name = "walkdir" version = "2.3.1" @@ -2140,70 +2410,77 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + [[package]] name = "wasm-bindgen" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" +checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ - "cfg-if", + "cfg-if 1.0.0", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" +checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" dependencies = [ "bumpalo", "lazy_static", "log", - "proc-macro2 1.0.24", - "quote 1.0.7", - "syn 1.0.44", + "proc-macro2", + "quote", + "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" +checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ - "quote 1.0.7", + "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" +checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.7", - "syn 1.0.44", + "proc-macro2", + "quote", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.68" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" +checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" [[package]] name = "wayland-client" -version = "0.21.13" +version = "0.28.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49963e5f9eeaf637bfcd1b9f0701c99fd5cd05225eb51035550d4272806f2713" +checksum = "e3ab332350e502f159382201394a78e3cc12d0f04db863429260164ea40e0355" dependencies = [ "bitflags", "downcast-rs", "libc", - "nix 0.14.1", + "nix 0.20.2", + "scoped-tls", "wayland-commons", "wayland-scanner", "wayland-sys", @@ -2211,48 +2488,87 @@ dependencies = [ [[package]] name = "wayland-commons" -version = "0.21.13" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21817947c7011bbd0a27e11b17b337bfd022e8544b071a2641232047966fbda" +dependencies = [ + "nix 0.20.2", + "once_cell", + "smallvec", + "wayland-sys", +] + +[[package]] +name = "wayland-cursor" +version = "0.28.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be610084edd1586d45e7bdd275fe345c7c1873598caa464c4fb835dee70fa65a" +dependencies = [ + "nix 0.20.2", + "wayland-client", + "xcursor", +] + +[[package]] +name = "wayland-egl" +version = "0.28.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40c08896768b667e1df195d88a62a53a2d1351a1ed96188be79c196b35bb32ec" +checksum = "99ba1ab1e18756b23982d36f08856d521d7df45015f404a2d7c4f0b2d2f66956" dependencies = [ - "nix 0.14.1", + "wayland-client", "wayland-sys", ] [[package]] name = "wayland-protocols" -version = "0.21.13" +version = "0.28.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afde2ea2a428eee6d7d2c8584fdbe8b82eee8b6c353e129a434cd6e07f42145" +checksum = "286620ea4d803bacf61fa087a4242ee316693099ee5a140796aaba02b29f861f" dependencies = [ "bitflags", "wayland-client", "wayland-commons", "wayland-scanner", - "wayland-sys", ] [[package]] name = "wayland-scanner" -version = "0.21.13" +version = "0.28.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf3828c568714507315ee425a9529edc4a4aa9901409e373e9e0027e7622b79e" +checksum = "ce923eb2deb61de332d1f356ec7b6bf37094dc5573952e1c8936db03b54c03f1" dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", + "proc-macro2", + "quote", "xml-rs", ] [[package]] name = "wayland-sys" -version = "0.21.13" +version = "0.28.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520ab0fd578017a0ee2206623ba9ef4afe5e8f23ca7b42f6acfba2f4e66b1628" +checksum = "d841fca9aed7febf9bed2e9796c49bf58d4152ceda8ac949ebe00868d8f0feb8" dependencies = [ - "dlib", + "dlib 0.5.0", "lazy_static", + "pkg-config", +] + +[[package]] +name = "web-sys" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" +dependencies = [ + "js-sys", + "wasm-bindgen", ] +[[package]] +name = "weezl" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b77fdfd5a253be4ab714e4ffa3c49caf146b4de743e97510c0656cf90f1e8e" + [[package]] name = "winapi" version = "0.3.9" @@ -2286,23 +2602,30 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winit" -version = "0.19.5" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e96eb4bb472fa43e718e8fa4aef82f86cd9deac9483a1e1529230babdb394a8" +checksum = "79610794594d5e86be473ef7763f604f2159cbac8c94debd00df8fb41e86c2f8" dependencies = [ - "android_glue", - "backtrace", "bitflags", "cocoa", - "core-foundation", - "core-graphics", + "core-foundation 0.9.2", + "core-graphics 0.22.2", + "core-video-sys", + "dispatch", + "instant", "lazy_static", "libc", "log", + "mio", + "mio-misc", + "ndk", + "ndk-glue", + "ndk-sys", "objc", "parking_lot", "percent-encoding", "raw-window-handle", + "scopeguard", "smithay-client-toolkit", "wayland-client", "winapi", @@ -2321,6 +2644,15 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "xcursor" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "463705a63313cd4301184381c5e8042f0a7e9b4bb63653f216311d4ae74690b7" +dependencies = [ + "nom 7.0.0", +] + [[package]] name = "xdg" version = "2.2.0" @@ -2329,9 +2661,9 @@ checksum = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57" [[package]] name = "xi-unicode" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e71b85d8b1b8bfaf4b5c834187554d201a8cd621c2bbfa33efd41a3ecabd48b2" +checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" [[package]] name = "xml-rs" diff --git a/Cargo.toml b/Cargo.toml index 47dc189..eb15da7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,6 @@ opt-level = 3 [dependencies] -# ggez = "0.5" -ggez = { git = "https://github.com/Brian-Catcow-B/ggez.git", branch = "master-custom-gamepads" } +ggez = "0.6" rand = "0.7.3" -gilrs = "0.7.4" \ No newline at end of file +glam = "0.19.0" diff --git a/src/control.rs b/src/control.rs index b78d70d..88618f0 100644 --- a/src/control.rs +++ b/src/control.rs @@ -52,7 +52,7 @@ impl Control { } // this is run once every frame and passes control off to whichever state the game is in -impl EventHandler for Control { +impl EventHandler for Control { fn update(&mut self, ctx: &mut Context) -> GameResult<()> { const DESIRED_FPS: u32 = 60; diff --git a/src/game.rs b/src/game.rs index efd9562..fefd38f 100644 --- a/src/game.rs +++ b/src/game.rs @@ -1,9 +1,10 @@ use ggez::event::{Axis, Button, GamepadId, KeyCode}; use ggez::graphics::{self, spritebatch, DrawParam}; -use ggez::graphics::{Scale, Text, TextFragment}; -use ggez::nalgebra::{Point2, Vector2}; +use ggez::graphics::{PxScale, Text, TextFragment}; use ggez::Context; +use ggez::mint::{Point2, Vector2}; + use rand::random; use crate::control::ProgramState; @@ -288,10 +289,10 @@ impl Game { for x in 0..board_width { for y in 0..board_height as usize { // empty tiles - let empty_tile = graphics::DrawParam::new().dest(Point2::new( + let empty_tile = graphics::DrawParam::new().dest(Point2::from_slice(&[ x as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - )); + ])); batch_empty_tile.add(empty_tile); } } @@ -326,53 +327,54 @@ impl Game { TileGraphic::new_player(ctx, player as u8).image, )); } + let little_text_scale = PxScale::from(LITTLE_TEXT_SCALE); let mut game_info_text = match mode { GameMode::None => panic!(GAME_MODE_NONE), GameMode::Classic => Text::new( TextFragment::new("Lines: ") - .color(graphics::WHITE) - .scale(Scale::uniform(LITTLE_TEXT_SCALE)), + .color(graphics::Color::WHITE) + .scale(little_text_scale), ), GameMode::Rotatris => Text::new( TextFragment::new("Rings: ") - .color(graphics::WHITE) - .scale(Scale::uniform(LITTLE_TEXT_SCALE)), + .color(graphics::Color::WHITE) + .scale(little_text_scale), ), }; game_info_text.add( TextFragment::new("000") - .color(graphics::WHITE) - .scale(Scale::uniform(LITTLE_TEXT_SCALE)), + .color(graphics::Color::WHITE) + .scale(little_text_scale), ); game_info_text.add( TextFragment::new(" Score: ") - .color(graphics::WHITE) - .scale(Scale::uniform(LITTLE_TEXT_SCALE)), + .color(graphics::Color::WHITE) + .scale(little_text_scale), ); game_info_text.add( TextFragment::new("0000000") - .color(graphics::WHITE) - .scale(Scale::uniform(LITTLE_TEXT_SCALE)), + .color(graphics::Color::WHITE) + .scale(little_text_scale), ); game_info_text.add( TextFragment::new(" Level: ") - .color(graphics::WHITE) - .scale(Scale::uniform(LITTLE_TEXT_SCALE)), + .color(graphics::Color::WHITE) + .scale(little_text_scale), ); game_info_text.add( TextFragment::new(format!("{:02}", game_options.starting_level)) - .color(graphics::WHITE) - .scale(Scale::uniform(LITTLE_TEXT_SCALE)), + .color(graphics::Color::WHITE) + .scale(little_text_scale), ); let pause_text = Text::new( TextFragment::new("PAUSED\n\nDown + ESC/Start to quit") - .color(graphics::WHITE) - .scale(Scale::uniform(LITTLE_TEXT_SCALE)), + .color(graphics::Color::WHITE) + .scale(little_text_scale), ); let game_over_text = Text::new( TextFragment::new("Game Over!") - .color(graphics::WHITE) - .scale(Scale::uniform(LITTLE_TEXT_SCALE * 2.0)), + .color(graphics::Color::WHITE) + .scale(PxScale::from(LITTLE_TEXT_SCALE * 2.0)), ); let (window_width, window_height) = graphics::size(ctx); @@ -837,7 +839,7 @@ impl Game { let height = self.bh.get_height(); // start doing drawing stuff - graphics::clear(ctx, graphics::BLACK); + graphics::clear(ctx, graphics::Color::BLACK); let (window_width, window_height) = graphics::size(ctx); if self.game_over_flag && self.game_over_delay == 0 { // DRAW GAME OVER @@ -880,10 +882,10 @@ impl Game { ), }; // create the proper DrawParam and add to the spritebatch - let player_tile = graphics::DrawParam::new().dest(Point2::new( + let player_tile = graphics::DrawParam::new().dest(Point2::from_slice(&[ x_draw_pos as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, y_draw_pos as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - )); + ])); if self.num_players > 1 { let player = self.bh.get_player_from_pos(y + height_buffer, x); self.vec_batch_player_piece[player as usize].add(player_tile); @@ -914,15 +916,17 @@ impl Game { let board_max_index_remainder_2 = (width - 1) % 2; // go from the middle to the outside and reach the end right before full_line.clear_delay reaches 0 for x in (width / 2)..width { - let highlight_pos_right = graphics::DrawParam::new().dest(Point2::new( - x as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - )); - let highlight_pos_left = graphics::DrawParam::new().dest(Point2::new( - (width as f32 - (x + board_max_index_remainder_2) as f32) - * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - )); + let highlight_pos_right = + graphics::DrawParam::new().dest(Point2::from_slice(&[ + x as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + ])); + let highlight_pos_left = + graphics::DrawParam::new().dest(Point2::from_slice(&[ + (width as f32 - (x + board_max_index_remainder_2) as f32) + * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + ])); self.batch_highlight_clearing_standard_tile .add(highlight_pos_right); @@ -941,15 +945,17 @@ impl Game { let board_max_index_remainder_2 = (width - 1) % 2; // go from the middle to the outside and reach the end right before full_line.clear_delay reaches 0 for x in (width / 2)..width { - let highlight_pos_right = graphics::DrawParam::new().dest(Point2::new( - x as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - )); - let highlight_pos_left = graphics::DrawParam::new().dest(Point2::new( - (width as f32 - (x + board_max_index_remainder_2) as f32) - * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - )); + let highlight_pos_right = + graphics::DrawParam::new().dest(Point2::from_slice(&[ + x as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + ])); + let highlight_pos_left = + graphics::DrawParam::new().dest(Point2::from_slice(&[ + (width as f32 - (x + board_max_index_remainder_2) as f32) + * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + ])); self.batch_highlight_clearing_tetrisnt_tile .add(highlight_pos_right); @@ -984,10 +990,11 @@ impl Game { if self.vec_next_piece[player.player_num as usize].matrix [y as usize][x as usize] { - let next_tile = graphics::DrawParam::new().dest(Point2::new( - x as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - )); + let next_tile = + graphics::DrawParam::new().dest(Point2::from_slice(&[ + x as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + ])); self.vec_batch_next_piece[player.player_num as usize] .add(next_tile); } @@ -1002,10 +1009,11 @@ impl Game { if self.vec_next_piece[player.player_num as usize].matrix [y as usize][x as usize] { - let next_tile = graphics::DrawParam::new().dest(Point2::new( - x as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, - )); + let next_tile = + graphics::DrawParam::new().dest(Point2::from_slice(&[ + x as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + y as f32 * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, + ])); self.vec_batch_next_piece[color_number_singleplayer] .add(next_tile); } @@ -1025,11 +1033,11 @@ impl Game { ctx, &self.batch_empty_tile, DrawParam::new() - .dest(Point2::new( + .dest(Point2::from_slice(&[ board_top_left_corner, NON_BOARD_SPACE_U as f32 * self.tile_size, - )) - .scale(Vector2::new(scaled_tile_size, scaled_tile_size)), + ])) + .scale(Vector2::from_slice(&[scaled_tile_size, scaled_tile_size])), ) .unwrap(); // player tiles @@ -1038,11 +1046,11 @@ impl Game { ctx, &self.vec_batch_player_piece[player as usize], DrawParam::new() - .dest(Point2::new( + .dest(Point2::from_slice(&[ board_top_left_corner, NON_BOARD_SPACE_U as f32 * self.tile_size, - )) - .scale(Vector2::new(scaled_tile_size, scaled_tile_size)), + ])) + .scale(Vector2::from_slice(&[scaled_tile_size, scaled_tile_size])), ) .unwrap(); } @@ -1051,11 +1059,11 @@ impl Game { ctx, &self.batch_highlight_active_tile, DrawParam::new() - .dest(Point2::new( + .dest(Point2::from_slice(&[ board_top_left_corner, NON_BOARD_SPACE_U as f32 * self.tile_size, - )) - .scale(Vector2::new(scaled_tile_size, scaled_tile_size)), + ])) + .scale(Vector2::from_slice(&[scaled_tile_size, scaled_tile_size])), ) .unwrap(); // clearing tile standard highlights @@ -1063,11 +1071,11 @@ impl Game { ctx, &self.batch_highlight_clearing_standard_tile, DrawParam::new() - .dest(Point2::new( + .dest(Point2::from_slice(&[ board_top_left_corner, NON_BOARD_SPACE_U as f32 * self.tile_size, - )) - .scale(Vector2::new(scaled_tile_size, scaled_tile_size)), + ])) + .scale(Vector2::from_slice(&[scaled_tile_size, scaled_tile_size])), ) .unwrap(); // clearing tile tetrisnt highlights @@ -1075,11 +1083,11 @@ impl Game { ctx, &self.batch_highlight_clearing_tetrisnt_tile, DrawParam::new() - .dest(Point2::new( + .dest(Point2::from_slice(&[ board_top_left_corner, NON_BOARD_SPACE_U as f32 * self.tile_size, - )) - .scale(Vector2::new(scaled_tile_size, scaled_tile_size)), + ])) + .scale(Vector2::from_slice(&[scaled_tile_size, scaled_tile_size])), ) .unwrap(); // next piece tiles @@ -1089,15 +1097,15 @@ impl Game { ctx, &self.vec_batch_next_piece[player.player_num as usize], DrawParam::new() - .dest(Point2::new( + .dest(Point2::from_slice(&[ board_top_left_corner + (player.spawn_column - 2) as f32 * scaled_tile_size * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, (NON_BOARD_SPACE_U - BOARD_NEXT_PIECE_SPACING) as f32 * self.tile_size, - )) - .scale(Vector2::new(scaled_tile_size, scaled_tile_size)), + ])) + .scale(Vector2::from_slice(&[scaled_tile_size, scaled_tile_size])), ) .unwrap(); } else { @@ -1106,15 +1114,15 @@ impl Game { ctx, &self.vec_batch_next_piece[color_number_singleplayer], DrawParam::new() - .dest(Point2::new( + .dest(Point2::from_slice(&[ board_top_left_corner + (spawn_column - 2) as f32 * scaled_tile_size * NUM_PIXEL_ROWS_PER_TILEGRAPHIC as f32, (NON_BOARD_SPACE_U - BOARD_NEXT_PIECE_SPACING) as f32 * self.tile_size, - )) - .scale(Vector2::new(scaled_tile_size, scaled_tile_size)), + ])) + .scale(Vector2::from_slice(&[scaled_tile_size, scaled_tile_size])), ) .unwrap(); } @@ -1148,14 +1156,14 @@ impl Game { vertical_position: f32, window_dimensions: &(f32, f32), ) { - let (text_width, text_height) = text_var.dimensions(ctx); + let text_var_dimensions = text_var.dimensions(ctx); graphics::draw( ctx, text_var, - DrawParam::new().dest(Point2::new( - (window_dimensions.0 - text_width as f32) / 2.0, - (window_dimensions.1 - text_height as f32) * vertical_position, - )), + DrawParam::new().dest(Point2::from_slice(&[ + (window_dimensions.0 - text_var_dimensions.w as f32) / 2.0, + (window_dimensions.1 - text_var_dimensions.h as f32) * vertical_position, + ])), ) .unwrap(); } diff --git a/src/main.rs b/src/main.rs index 27ccd31..596a680 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ -use ggez::event; use ggez::graphics; +use ggez::input::gamepad::gilrs; use ggez::ContextBuilder; // file systems stuff @@ -31,7 +31,7 @@ fn main() { context = context.add_resource_path(path); } - let (ctx, event_loop) = &mut context.build().expect("[!] Failed to build context"); + let (mut ctx, event_loop) = context.build().expect("[!] Failed to build context"); // custom controller setup stuffs let mut gilrs_builder = gilrs::GilrsBuilder::new().add_included_mappings(false); @@ -55,17 +55,15 @@ fn main() { ctx.gamepad_context = Box::new(GilrsGamepadContext::from(gilrs_builder.build().unwrap())); // set window size - graphics::set_resizable(ctx, true).expect("[!] Failed to set window to resizable"); - graphics::set_drawable_size(ctx, 800.0, 600.0).expect("[!] Failed to resize window"); + graphics::set_resizable(&mut ctx, true).expect("[!] Failed to set window to resizable"); + graphics::set_drawable_size(&mut ctx, 800.0, 600.0).expect("[!] Failed to resize window"); // make it not blurry - graphics::set_default_filter(ctx, graphics::FilterMode::Nearest); + graphics::set_default_filter(&mut ctx, graphics::FilterMode::Nearest); // create an instance of the event handler - let mut control = Control::new(ctx); + let control = Control::new(&mut ctx); // loop that controls the ProgramState - if let Err(e) = event::run(ctx, event_loop, &mut control) { - println!("[!] Error occured: {}", e); - } + ggez::event::run(ctx, event_loop, control) } diff --git a/src/menu/choosemode.rs b/src/menu/choosemode.rs index 60c6070..8e75926 100644 --- a/src/menu/choosemode.rs +++ b/src/menu/choosemode.rs @@ -1,5 +1,5 @@ use ggez::graphics::{self, DrawParam, Text}; -use ggez::nalgebra::Point2; +use ggez::mint::Point2; use ggez::Context; use crate::game::GameMode; @@ -90,14 +90,14 @@ impl ChooseModeMenu { vertical_position: f32, window_dimensions: &(f32, f32), ) { - let (text_width, text_height) = text_var.dimensions(ctx); + let text_var_dimensions = text_var.dimensions(ctx); graphics::draw( ctx, text_var, - DrawParam::new().dest(Point2::new( - (window_dimensions.0 - text_width as f32) / 2.0, - (window_dimensions.1 - text_height as f32) * vertical_position, - )), + DrawParam::new().dest(Point2::from_slice(&[ + (window_dimensions.0 - text_var_dimensions.w as f32) / 2.0, + (window_dimensions.1 - text_var_dimensions.h as f32) * vertical_position, + ])), ) .unwrap(); } diff --git a/src/menu/inputconfig.rs b/src/menu/inputconfig.rs index b6789b4..b021d80 100644 --- a/src/menu/inputconfig.rs +++ b/src/menu/inputconfig.rs @@ -1,6 +1,6 @@ use ggez::event::KeyCode; -use ggez::graphics::{self, DrawParam, Scale, Text, TextFragment}; -use ggez::nalgebra::Point2; +use ggez::graphics::{self, DrawParam, PxScale, Text, TextFragment}; +use ggez::mint::Point2; use ggez::Context; use crate::game::GameMode; @@ -87,7 +87,7 @@ impl InputConfigMenu { window_dimensions, ), } - // Self::setup_rotatris_mode_subtext(&mut vec_menu_items_keycode, game_options, window_dimensions); + let scale = PxScale::from(window_dimensions.1 / SUB_TEXT_SCALE_DOWN); Self { selection: 0, player_num: 0, @@ -103,17 +103,17 @@ impl InputConfigMenu { input_uninitialized_text: Text::new( TextFragment::new("No Controls\nKeyboard: Space/Enter\nGamepad: 'G'") .color(HELP_RED) - .scale(Scale::uniform(window_dimensions.1 / SUB_TEXT_SCALE_DOWN)), + .scale(scale), ), keycode_conflict_text: Text::new( TextFragment::new("[!] Redundant KeyCode; ignoring") .color(HELP_RED) - .scale(Scale::uniform(window_dimensions.1 / SUB_TEXT_SCALE_DOWN)), + .scale(scale), ), is_gamepad_text: Text::new( TextFragment::new("Set to Gamepad\n\n\nSee README for help") - .color(graphics::BLACK) - .scale(Scale::uniform(window_dimensions.1 / SUB_TEXT_SCALE_DOWN)), + .color(graphics::Color::BLACK) + .scale(scale), ), } } @@ -472,7 +472,12 @@ impl InputConfigMenu { ) .unwrap(); } - graphics::draw(ctx, &editing_indicator_rectangle, (Point2::new(0.0, 0.0),)).unwrap(); + graphics::draw( + ctx, + &editing_indicator_rectangle, + (Point2::from_slice(&[0.0, 0.0]),), + ) + .unwrap(); if self.vec_menu_items_main[self.selection].trigger == MenuItemTrigger::SubSelection { if self.keycode_conflict_flag { @@ -506,14 +511,14 @@ impl InputConfigMenu { vertical_position: f32, window_dimensions: &(f32, f32), ) { - let (text_width, text_height) = text_var.dimensions(ctx); + let text_var_dimensions = text_var.dimensions(ctx); graphics::draw( ctx, text_var, - DrawParam::new().dest(Point2::new( - (window_dimensions.0 - text_width as f32) / 2.0, - (window_dimensions.1 - text_height as f32) * vertical_position, - )), + DrawParam::new().dest(Point2::from_slice(&[ + (window_dimensions.0 - text_var_dimensions.w as f32) / 2.0, + (window_dimensions.1 - text_var_dimensions.h as f32) * vertical_position, + ])), ) .unwrap(); } diff --git a/src/menu/menuhelpers.rs b/src/menu/menuhelpers.rs index 71d2d46..fe05b6e 100644 --- a/src/menu/menuhelpers.rs +++ b/src/menu/menuhelpers.rs @@ -1,5 +1,5 @@ use ggez::event::KeyCode; -use ggez::graphics::{self, Color, Font, Scale, Text, TextFragment}; +use ggez::graphics::{self, Color, Font, PxScale, Text, TextFragment}; use crate::game::GameMode; use crate::inputs::KeyboardControlScheme; @@ -66,7 +66,7 @@ impl MenuItem { text_scale_down: f32, trigger: MenuItemTrigger, ) -> Self { - let mut text = Text::new(TextFragment::new(item_start_str).color(graphics::BLACK)); + let mut text = Text::new(TextFragment::new(item_start_str).color(graphics::Color::BLACK)); let mut num_values = 0; let mut value_show_increase = 0; match value_type { @@ -76,36 +76,36 @@ impl MenuItem { value_show_increase = 1; text.add( TextFragment::new(format!(" {}", value + value_show_increase)) - .color(graphics::BLACK), + .color(graphics::Color::BLACK), ); } MenuItemValueType::StartingLevel => { num_values = MAX_STARTING_LEVEL + 1; // level indexes by 0, so we have one more than max starting level - text.add(TextFragment::new(format!(" {}", value)).color(graphics::BLACK)); + text.add(TextFragment::new(format!(" {}", value)).color(graphics::Color::BLACK)); } MenuItemValueType::PlayerNum => { num_values = MAX_NUM_PLAYERS; value_show_increase = 1; text.add( TextFragment::new(format!(" {}", value + value_show_increase)) - .color(graphics::BLACK), + .color(graphics::Color::BLACK), ); } MenuItemValueType::KeyCode => { match keycode { - Some(key) => { - text.add(TextFragment::new(format!("{:?}", key)).color(graphics::BLACK)) - } - None => text.add(TextFragment::new("None".to_string()).color(graphics::BLACK)), + Some(key) => text + .add(TextFragment::new(format!("{:?}", key)).color(graphics::Color::BLACK)), + None => text + .add(TextFragment::new("None".to_string()).color(graphics::Color::BLACK)), }; } MenuItemValueType::Custom => { - text.add(TextFragment::new("".to_string()).color(graphics::BLACK)); + text.add(TextFragment::new("".to_string()).color(graphics::Color::BLACK)); } } text.set_font( Font::default(), - Scale::uniform(window_height / text_scale_down), + PxScale::from(window_height / text_scale_down), ); Self { text, @@ -125,13 +125,13 @@ impl MenuItem { self.text.fragments_mut()[0].color = Some(if select { SELECT_GREEN } else { - graphics::BLACK + graphics::Color::BLACK }); if self.value_type != MenuItemValueType::None { self.text.fragments_mut()[1].color = Some(if select { SELECT_GREEN } else { - graphics::BLACK + graphics::Color::BLACK }); if self.value_type == MenuItemValueType::NumPlayers || self.value_type == MenuItemValueType::StartingLevel @@ -176,7 +176,7 @@ impl MenuItem { pub fn resize(&mut self, window_height: f32) { self.text.set_font( Font::default(), - Scale::uniform(window_height / self.text_scale_down), + PxScale::from(window_height / self.text_scale_down), ); } diff --git a/src/menu/start.rs b/src/menu/start.rs index 29d734f..ba88c15 100644 --- a/src/menu/start.rs +++ b/src/menu/start.rs @@ -1,5 +1,5 @@ use ggez::graphics::{self, DrawParam, Text, TextFragment}; -use ggez::nalgebra::Point2; +use ggez::mint::Point2; use ggez::Context; use crate::game::GameMode; @@ -202,14 +202,14 @@ impl StartMenu { vertical_position: f32, window_dimensions: &(f32, f32), ) { - let (text_width, text_height) = text_var.dimensions(ctx); + let text_var_dimensions = text_var.dimensions(ctx); graphics::draw( ctx, text_var, - DrawParam::new().dest(Point2::new( - (window_dimensions.0 - text_width as f32) / 2.0, - (window_dimensions.1 - text_height as f32) * vertical_position, - )), + DrawParam::new().dest(Point2::from_slice(&[ + (window_dimensions.0 - text_var_dimensions.w as f32) / 2.0, + (window_dimensions.1 - text_var_dimensions.h as f32) * vertical_position, + ])), ) .unwrap(); } From 9250ab4deb42a20f243d875489c71e1e5799ca77 Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 28 Oct 2021 01:29:17 -0400 Subject: [PATCH 2/5] better differentiable colors (maybe, idk, I'm colorblind) --- src/game/tile.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/tile.rs b/src/game/tile.rs index bbbf5e8..61aa04a 100644 --- a/src/game/tile.rs +++ b/src/game/tile.rs @@ -76,11 +76,11 @@ const PLAYER_RGBA: [(u8, u8, u8, u8); NUM_PLAYERCOLORS as usize] = [ (80u8, 200u8, 60u8, 0xffu8), (230u8, 230u8, 50u8, 0xffu8), (220u8, 150u8, 70u8, 0xffu8), - (160u8, 230u8, 250u8, 0xffu8), + (125u8, 125u8, 125u8, 0xffu8), (230u8, 100u8, 210u8, 0xffu8), ]; -const BASE_PLAYER_COLOR: (u8, u8, u8, u8) = (20u8, 80u8, 150u8, 0xffu8); +const BASE_PLAYER_COLOR: (u8, u8, u8, u8) = (25u8, 80u8, 212u8, 0xffu8); #[derive(Copy, Clone)] pub struct Tile { From b9280c52ce2652a166c9faacfce7b937f0cdcca8 Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 28 Oct 2021 01:36:31 -0400 Subject: [PATCH 3/5] readme update --- README.md | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e7de4a9..20e0131 100644 --- a/README.md +++ b/README.md @@ -4,32 +4,27 @@ Tetrisn-t (python version) rewritten in Rust, better. Binaries for Windows and Linux are included in each tagged release. # Build -Download and install cargo, then set rustup default to 1.47.0 to avoid an error in the ggez library introduced with rust 1.48.0 by running -``` -rustup default 1.47.0 -``` -then build with +Download and install cargo, then build with ``` cargo build --release ``` and find the resulting binary in `./target/release/` -Google any errors that occur, if they do. +Google any errors that occur, if they do (there are a few necessary libraries). -# Gamepads +# Controls In the "Controls" menu, keyboard control schemes and setting players to use gamepads are both possible and mostly self explanatory. It is possible to connect multiple keyboards to one PC and use both separately, but the inputs show up as the same, so the keyboard control schemes are not allowed to overlap, even across separate keyboards. There is a check in place, which will give a notice when a key is attempted to be re-used. -Unfortunately, these settings are not saved yet, so they will have to be reconfigured each time the program is opened; eventually, saved control schemes will be implemented. +Unfortunately, these settings are not saved yet, so they will have to be reconfigured each time the program is opened. Setting a player to use a gamepad is easily done in the "Controls" menu by pressing 'G', as it states. -The game decides which specific gamepad controls which player by assigning a gamepad's id to the first player that doesn't yet have an assigned gamepad id as soon as an unassigned gamepad has a button/axis pressed during gameplay. -Because of weird coding stuff, this is done each game no matter what, but might eventually be extended to be the entire instance of the program. +The game decides which gamepad controls which player by assigning gamepads to players as inputs are made. +Due to easier coding, this is done each game no matter what. -## Custom Layouts and Obscure Compatibility +## Custom Gamepad Layouts and Obscure Compatibility ### Windows -Because ggez only supports xinput, a program like rewasd is required for non-xinput controllers, which allows remapping of non-xinput controllers to act as an xinput controller. -rewasd does cost money (unless you download an earlier version from 3rd party), but here's an alternative: http://ds4windows.com/ +Because ggez only supports xinput for Windows, a program like rewasd is required for non-xinput controllers, which allows remapping of non-xinput controllers to act as an xinput controller. ### Linux For linux, this program uses SDL2 gamepad configurations for controllers. From 554fb88871992cdf88c5871b9d8f8e261b747515 Mon Sep 17 00:00:00 2001 From: brian Date: Sat, 30 Oct 2021 13:23:25 -0400 Subject: [PATCH 4/5] fix non_fmt_panics warnings --- src/game.rs | 8 ++++---- src/game/board.rs | 32 ++++++++++++++++---------------- src/menu/inputconfig.rs | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/game.rs b/src/game.rs index fefd38f..f27190b 100644 --- a/src/game.rs +++ b/src/game.rs @@ -124,7 +124,7 @@ impl From<&MenuGameOptions> for GameOptions { Vec::with_capacity(menu_game_options.arr_controls.len()); let mut counted_active_controls: u8 = 0; match menu_game_options.game_mode { - GameMode::None => panic!(GAME_MODE_NONE), + GameMode::None => panic!("{}", GAME_MODE_NONE), GameMode::Classic => { for ctrls in menu_game_options.arr_controls.iter() { if !(ctrls.0).is_empty() { @@ -246,12 +246,12 @@ impl Game { pub fn new(ctx: &mut Context, game_options: &GameOptions) -> Game { let mode = game_options.game_mode; let board_width = match mode { - GameMode::None => panic!(GAME_MODE_NONE), + GameMode::None => panic!("{}", GAME_MODE_NONE), GameMode::Classic => 6 + 4 * game_options.num_players, GameMode::Rotatris => ROTATRIS_BOARD_SIDE_LENGTH, }; let board_height = match mode { - GameMode::None => panic!(GAME_MODE_NONE), + GameMode::None => panic!("{}", GAME_MODE_NONE), GameMode::Classic => BOARD_HEIGHT, GameMode::Rotatris => ROTATRIS_BOARD_SIDE_LENGTH, }; @@ -329,7 +329,7 @@ impl Game { } let little_text_scale = PxScale::from(LITTLE_TEXT_SCALE); let mut game_info_text = match mode { - GameMode::None => panic!(GAME_MODE_NONE), + GameMode::None => panic!("{}", GAME_MODE_NONE), GameMode::Classic => Text::new( TextFragment::new("Lines: ") .color(graphics::Color::WHITE) diff --git a/src/game/board.rs b/src/game/board.rs index efa09eb..54c30f0 100644 --- a/src/game/board.rs +++ b/src/game/board.rs @@ -55,14 +55,14 @@ impl BoardHandler { pub fn new(board_width: u8, board_height: u8, num_players: u8, mode: GameMode) -> Self { // determine some rules based on gamemode let (board_height_buffer, spawn_row) = match mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Rotatris => (0, (board_height - 1) / 2), GameMode::Classic => (2, 0), }; let mut classic: Option = None; let mut rotatris: Option = None; match mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Rotatris => { rotatris = Some(BoardRotatris::new(board_width, spawn_row, num_players)) } @@ -86,7 +86,7 @@ impl BoardHandler { // get... pub fn get_width(&mut self) -> u8 { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => self.classic.as_mut().expect(BH_WRONG_MODE).width, GameMode::Rotatris => self.rotatris.as_mut().expect(BH_WRONG_MODE).board_size, } @@ -94,7 +94,7 @@ impl BoardHandler { pub fn get_height(&mut self) -> u8 { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => self.classic.as_mut().expect(BH_WRONG_MODE).height, GameMode::Rotatris => self.rotatris.as_mut().expect(BH_WRONG_MODE).board_size, } @@ -102,7 +102,7 @@ impl BoardHandler { pub fn get_height_buffer(&mut self) -> u8 { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => self.classic.as_mut().expect(BH_WRONG_MODE).height_buffer, GameMode::Rotatris => 0u8, } @@ -110,7 +110,7 @@ impl BoardHandler { pub fn get_active_from_pos(&mut self, y: u8, x: u8) -> bool { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => { self.classic.as_mut().expect(BH_WRONG_MODE).matrix[y as usize][x as usize].active } @@ -122,7 +122,7 @@ impl BoardHandler { pub fn get_empty_from_pos(&mut self, y: u8, x: u8) -> bool { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => { self.classic.as_mut().expect(BH_WRONG_MODE).matrix[y as usize][x as usize].empty } @@ -134,7 +134,7 @@ impl BoardHandler { pub fn get_player_from_pos(&mut self, y: u8, x: u8) -> u8 { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => { self.classic.as_mut().expect(BH_WRONG_MODE).matrix[y as usize][x as usize].player } @@ -146,7 +146,7 @@ impl BoardHandler { pub fn get_shape_from_pos(&mut self, y: u8, x: u8) -> Shapes { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => { self.classic.as_mut().expect(BH_WRONG_MODE).matrix[y as usize][x as usize].shape } @@ -158,7 +158,7 @@ impl BoardHandler { pub fn get_shape_from_player(&mut self, player: u8) -> Shapes { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => { self.classic.as_mut().expect(BH_WRONG_MODE).vec_active_piece[player as usize].shape } @@ -174,7 +174,7 @@ impl BoardHandler { pub fn get_fall_delay_from_level(&mut self, level: u8) -> u8 { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => FALL_DELAY_VALUES_CLASSIC[level as usize], GameMode::Rotatris => FALL_DELAY_VALUES_ROTATRIS[level as usize], } @@ -188,7 +188,7 @@ impl BoardHandler { spawn_piece_shape: Shapes, ) -> (bool, bool) { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => self .classic .as_mut() @@ -204,7 +204,7 @@ impl BoardHandler { pub fn attempt_clear(&mut self, level: u8) -> (u8, u32) { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => self .classic .as_mut() @@ -220,7 +220,7 @@ impl BoardHandler { pub fn attempt_piece_movement(&mut self, m: Movement, p: u8) -> (bool, bool) { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => self .classic .as_mut() @@ -236,7 +236,7 @@ impl BoardHandler { pub fn attempt_rotate_board(&mut self, rd: Movement) -> bool { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => { println!("[!] `attempt_rotate_board` called but mode is GameMode::Classic"); false @@ -251,7 +251,7 @@ impl BoardHandler { pub fn playerify_piece(&mut self, player: u8) { match self.mode { - GameMode::None => panic!(BH_MODE_NONE), + GameMode::None => panic!("{}", BH_MODE_NONE), GameMode::Classic => self .classic .as_mut() diff --git a/src/menu/inputconfig.rs b/src/menu/inputconfig.rs index b021d80..179f4ce 100644 --- a/src/menu/inputconfig.rs +++ b/src/menu/inputconfig.rs @@ -128,7 +128,7 @@ impl InputConfigMenu { game_options.reset_controls(); self.vec_used_keycode.clear(); match game_mode { - GameMode::None => panic!(GAME_MODE_UNEXPECTEDLY_NONE), + GameMode::None => panic!("{}", GAME_MODE_UNEXPECTEDLY_NONE), GameMode::Classic => Self::setup_classic_mode_subtext( &mut self.vec_menu_items_keycode, &game_options, From 801e5ecdefb6352b6cd9d6708b0c454cadc23f25 Mon Sep 17 00:00:00 2001 From: brian Date: Sun, 31 Oct 2021 19:08:43 -0400 Subject: [PATCH 5/5] use better macros than panic --- src/game.rs | 16 +++++++++------- src/game/board.rs | 34 +++++++++++++++++----------------- src/game/piece.rs | 28 ++++++++++++++++------------ src/game/player.rs | 4 +++- src/menu/inputconfig.rs | 2 +- 5 files changed, 46 insertions(+), 38 deletions(-) diff --git a/src/game.rs b/src/game.rs index f27190b..d8641a1 100644 --- a/src/game.rs +++ b/src/game.rs @@ -124,7 +124,7 @@ impl From<&MenuGameOptions> for GameOptions { Vec::with_capacity(menu_game_options.arr_controls.len()); let mut counted_active_controls: u8 = 0; match menu_game_options.game_mode { - GameMode::None => panic!("{}", GAME_MODE_NONE), + GameMode::None => unreachable!("{}", GAME_MODE_NONE), GameMode::Classic => { for ctrls in menu_game_options.arr_controls.iter() { if !(ctrls.0).is_empty() { @@ -246,12 +246,12 @@ impl Game { pub fn new(ctx: &mut Context, game_options: &GameOptions) -> Game { let mode = game_options.game_mode; let board_width = match mode { - GameMode::None => panic!("{}", GAME_MODE_NONE), + GameMode::None => unreachable!("{}", GAME_MODE_NONE), GameMode::Classic => 6 + 4 * game_options.num_players, GameMode::Rotatris => ROTATRIS_BOARD_SIDE_LENGTH, }; let board_height = match mode { - GameMode::None => panic!("{}", GAME_MODE_NONE), + GameMode::None => unreachable!("{}", GAME_MODE_NONE), GameMode::Classic => BOARD_HEIGHT, GameMode::Rotatris => ROTATRIS_BOARD_SIDE_LENGTH, }; @@ -329,7 +329,7 @@ impl Game { } let little_text_scale = PxScale::from(LITTLE_TEXT_SCALE); let mut game_info_text = match mode { - GameMode::None => panic!("{}", GAME_MODE_NONE), + GameMode::None => unreachable!("{}", GAME_MODE_NONE), GameMode::Classic => Text::new( TextFragment::new("Lines: ") .color(graphics::Color::WHITE) @@ -515,7 +515,8 @@ impl Game { break; } } - let random_shape = Shapes::from(rand % 7); + let random_shape = + Shapes::try_from(rand % 7).expect("Unable to get random piece"); if self.bh.get_shape_from_player(player.player_num) != random_shape { player.next_piece_shape = random_shape; } else { @@ -526,7 +527,8 @@ impl Game { break; } } - player.next_piece_shape = Shapes::from(rand % 7); + player.next_piece_shape = + Shapes::try_from(rand % 7).expect("Unable to get random piece"); } self.vec_next_piece[player.player_num as usize] = NextPiece::new(player.next_piece_shape); @@ -876,7 +878,7 @@ impl Game { center * 2 - x - is_center_even, ), Movement::Right => (x, center * 2 - y - is_center_even), - _ => panic!( + _ => unreachable!( "[!] Error: self.gravity_direction is {}", self.gravity_direction as u8 ), diff --git a/src/game/board.rs b/src/game/board.rs index 54c30f0..bf3996d 100644 --- a/src/game/board.rs +++ b/src/game/board.rs @@ -55,14 +55,14 @@ impl BoardHandler { pub fn new(board_width: u8, board_height: u8, num_players: u8, mode: GameMode) -> Self { // determine some rules based on gamemode let (board_height_buffer, spawn_row) = match mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Rotatris => (0, (board_height - 1) / 2), GameMode::Classic => (2, 0), }; let mut classic: Option = None; let mut rotatris: Option = None; match mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Rotatris => { rotatris = Some(BoardRotatris::new(board_width, spawn_row, num_players)) } @@ -86,7 +86,7 @@ impl BoardHandler { // get... pub fn get_width(&mut self) -> u8 { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => self.classic.as_mut().expect(BH_WRONG_MODE).width, GameMode::Rotatris => self.rotatris.as_mut().expect(BH_WRONG_MODE).board_size, } @@ -94,7 +94,7 @@ impl BoardHandler { pub fn get_height(&mut self) -> u8 { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => self.classic.as_mut().expect(BH_WRONG_MODE).height, GameMode::Rotatris => self.rotatris.as_mut().expect(BH_WRONG_MODE).board_size, } @@ -102,7 +102,7 @@ impl BoardHandler { pub fn get_height_buffer(&mut self) -> u8 { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => self.classic.as_mut().expect(BH_WRONG_MODE).height_buffer, GameMode::Rotatris => 0u8, } @@ -110,7 +110,7 @@ impl BoardHandler { pub fn get_active_from_pos(&mut self, y: u8, x: u8) -> bool { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => { self.classic.as_mut().expect(BH_WRONG_MODE).matrix[y as usize][x as usize].active } @@ -122,7 +122,7 @@ impl BoardHandler { pub fn get_empty_from_pos(&mut self, y: u8, x: u8) -> bool { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => { self.classic.as_mut().expect(BH_WRONG_MODE).matrix[y as usize][x as usize].empty } @@ -134,7 +134,7 @@ impl BoardHandler { pub fn get_player_from_pos(&mut self, y: u8, x: u8) -> u8 { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => { self.classic.as_mut().expect(BH_WRONG_MODE).matrix[y as usize][x as usize].player } @@ -146,7 +146,7 @@ impl BoardHandler { pub fn get_shape_from_pos(&mut self, y: u8, x: u8) -> Shapes { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => { self.classic.as_mut().expect(BH_WRONG_MODE).matrix[y as usize][x as usize].shape } @@ -158,7 +158,7 @@ impl BoardHandler { pub fn get_shape_from_player(&mut self, player: u8) -> Shapes { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => { self.classic.as_mut().expect(BH_WRONG_MODE).vec_active_piece[player as usize].shape } @@ -174,7 +174,7 @@ impl BoardHandler { pub fn get_fall_delay_from_level(&mut self, level: u8) -> u8 { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => FALL_DELAY_VALUES_CLASSIC[level as usize], GameMode::Rotatris => FALL_DELAY_VALUES_ROTATRIS[level as usize], } @@ -188,7 +188,7 @@ impl BoardHandler { spawn_piece_shape: Shapes, ) -> (bool, bool) { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => self .classic .as_mut() @@ -204,7 +204,7 @@ impl BoardHandler { pub fn attempt_clear(&mut self, level: u8) -> (u8, u32) { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => self .classic .as_mut() @@ -220,7 +220,7 @@ impl BoardHandler { pub fn attempt_piece_movement(&mut self, m: Movement, p: u8) -> (bool, bool) { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => self .classic .as_mut() @@ -236,7 +236,7 @@ impl BoardHandler { pub fn attempt_rotate_board(&mut self, rd: Movement) -> bool { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => { println!("[!] `attempt_rotate_board` called but mode is GameMode::Classic"); false @@ -251,7 +251,7 @@ impl BoardHandler { pub fn playerify_piece(&mut self, player: u8) { match self.mode { - GameMode::None => panic!("{}", BH_MODE_NONE), + GameMode::None => unreachable!("{}", BH_MODE_NONE), GameMode::Classic => self .classic .as_mut() @@ -982,7 +982,7 @@ impl BoardRotatris { } } Gravity::Invalid => { - panic!("[!] Gravity::Invalid attempted to be used in `should_lock()`") + unreachable!("[!] Gravity::Invalid attempted to be used in `should_lock()`") } } } diff --git a/src/game/piece.rs b/src/game/piece.rs index 40ebf00..b30c059 100644 --- a/src/game/piece.rs +++ b/src/game/piece.rs @@ -1,6 +1,8 @@ use crate::game::board::Gravity; use crate::movement::Movement; +use std::convert::TryFrom; + #[repr(u8)] #[derive(PartialEq, Eq, Copy, Clone)] pub enum Shapes { @@ -14,17 +16,19 @@ pub enum Shapes { None, } -impl From for Shapes { - fn from(value: u8) -> Shapes { +impl TryFrom for Shapes { + type Error = &'static str; + + fn try_from(value: u8) -> Result { match value { - 0 => Shapes::I, - 1 => Shapes::O, - 2 => Shapes::T, - 3 => Shapes::J, - 4 => Shapes::S, - 5 => Shapes::L, - 6 => Shapes::Z, - _ => panic!("Unknown Shapes value: {}", value), + 0 => Ok(Shapes::I), + 1 => Ok(Shapes::O), + 2 => Ok(Shapes::T), + 3 => Ok(Shapes::J), + 4 => Ok(Shapes::S), + 5 => Ok(Shapes::L), + 6 => Ok(Shapes::Z), + _ => Err("Conversion failed (u8 -> Shapes): Invalid value"), } } } @@ -234,7 +238,7 @@ impl Piece { } }; if piece_copy.shape == Shapes::None { - panic!("[!] Error: `Piece::spawn_pos()` called with shape: Shapes::None"); + unreachable!("[!] Error: `Piece::spawn_pos()` called with shape: Shapes::None"); } else if piece_copy.shape == Shapes::O { piece_copy.positions } else { @@ -252,7 +256,7 @@ impl Piece { piece_copy.positions = piece_copy.rotate(false); piece_copy.piece_pos(Movement::Down) } - Gravity::Invalid => panic!("[!] Gravity::Invalid passed into `spawn_pos()`"), + Gravity::Invalid => unreachable!("[!] Gravity::Invalid passed into `spawn_pos()`"), } } } diff --git a/src/game/player.rs b/src/game/player.rs index dab2d45..de4388f 100644 --- a/src/game/player.rs +++ b/src/game/player.rs @@ -7,6 +7,8 @@ use crate::game::{DETECT_GAMEPAD_AXIS_THRESHOLD, UNDETECT_GAMEPAD_AXIS_THRESHOLD use crate::inputs::{Input, KeyboardControlScheme}; use crate::movement::Movement; +use std::convert::TryFrom; + pub const SPAWN_DELAY: i16 = 20i16; pub struct Player { @@ -49,7 +51,7 @@ impl Player { break; } } - Shapes::from(rand % 7) + Shapes::try_from(rand % 7).expect("Unable to get random piece") }, redraw_next_piece_flag: true, fall_countdown: INITIAL_HANG_FRAMES, diff --git a/src/menu/inputconfig.rs b/src/menu/inputconfig.rs index 179f4ce..d06b98f 100644 --- a/src/menu/inputconfig.rs +++ b/src/menu/inputconfig.rs @@ -128,7 +128,7 @@ impl InputConfigMenu { game_options.reset_controls(); self.vec_used_keycode.clear(); match game_mode { - GameMode::None => panic!("{}", GAME_MODE_UNEXPECTEDLY_NONE), + GameMode::None => unreachable!("{}", GAME_MODE_UNEXPECTEDLY_NONE), GameMode::Classic => Self::setup_classic_mode_subtext( &mut self.vec_menu_items_keycode, &game_options,