diff --git a/Cargo.lock b/Cargo.lock index 2bbd5dff..95c5d182 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,6 +61,28 @@ dependencies = [ name = "alignment" version = "0.1.0" +[[package]] +name = "alsa" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5915f52fe2cf65e83924d037b6c5290b7cee097c6b5c8700746e6168a343fd6b" +dependencies = [ + "alsa-sys", + "bitflags 1.3.2", + "libc", + "nix 0.23.2", +] + +[[package]] +name = "alsa-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "android-activity" version = "0.5.1" @@ -71,14 +93,14 @@ dependencies = [ "bitflags 2.4.2", "cc", "cesu8", - "jni", + "jni 0.21.1", "jni-sys", "libc", "log", - "ndk", + "ndk 0.8.0", "ndk-context", - "ndk-sys", - "num_enum", + "ndk-sys 0.5.0+25.2.9519653", + "num_enum 0.7.2", "thiserror", ] @@ -121,6 +143,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + [[package]] name = "arrayref" version = "0.3.6" @@ -262,14 +293,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "base64" -version = "0.9.3" +name = "base-x" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -dependencies = [ - "byteorder", - "safemem", -] +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" [[package]] name = "base64" @@ -277,6 +304,32 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.4.2", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.48", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -445,6 +498,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -463,7 +525,7 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a98d30140e3296250832bbaaff83b27dcd6fa3cc70fb6f1f3e5c9c0023b5317" dependencies = [ - "approx", + "approx 0.4.0", "num-traits", ] @@ -479,6 +541,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "clang-sys" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +dependencies = [ + "glob", + "libc", + "libloading 0.8.0", +] + [[package]] name = "cmake" version = "0.1.48" @@ -644,6 +717,50 @@ dependencies = [ "libc", ] +[[package]] +name = "coreaudio-rs" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11894b20ebfe1ff903cbdc52259693389eea03b94918a2def2c30c3bf227ad88" +dependencies = [ + "bitflags 1.3.2", + "coreaudio-sys", +] + +[[package]] +name = "coreaudio-sys" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f01585027057ff5f0a5bf276174ae4c1594a2c5bde93d5f46a016d76270f5a9" +dependencies = [ + "bindgen", +] + +[[package]] +name = "cpal" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f342c1b63e185e9953584ff2199726bf53850d96610a310e3aca09e9405a2d0b" +dependencies = [ + "alsa", + "core-foundation-sys", + "coreaudio-rs", + "jni 0.19.0", + "js-sys", + "libc", + "mach", + "ndk 0.7.0", + "ndk-context", + "oboe", + "once_cell", + "parking_lot 0.12.1", + "stdweb", + "thiserror", + "wasm-bindgen", + "web-sys", + "windows 0.37.0", +] + [[package]] name = "crc32fast" version = "1.3.2" @@ -779,6 +896,12 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fb4b71acc1405be2431a93892a79a0d82ed5ba6885649ddbdfc62caa4d67b1c" +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "dispatch" version = "0.2.0" @@ -1187,6 +1310,44 @@ dependencies = [ "gl_generator", ] +[[package]] +name = "glyph_brush" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3676f482c536a985fca36ce320a5e5b8fafd7b260806742af1963b71c5dc38c" +dependencies = [ + "glyph_brush_draw_cache", + "glyph_brush_layout", + "ordered-float", + "rustc-hash", + "twox-hash", +] + +[[package]] +name = "glyph_brush_draw_cache" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6010675390f6889e09a21e2c8b575b3ee25667ea8237a8d59423f73cb8c28610" +dependencies = [ + "ab_glyph", + "crossbeam-channel", + "crossbeam-deque", + "linked-hash-map", + "rayon", + "rustc-hash", +] + +[[package]] +name = "glyph_brush_layout" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc32c2334f00ca5ac3695c5009ae35da21da8c62d255b5b96d56e2597a637a38" +dependencies = [ + "ab_glyph", + "approx 0.5.1", + "xi-unicode", +] + [[package]] name = "gpu-alloc" version = "0.6.0" @@ -1216,7 +1377,7 @@ dependencies = [ "presser", "thiserror", "winapi", - "windows", + "windows 0.51.1", ] [[package]] @@ -1330,6 +1491,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" +[[package]] +name = "hound" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62adaabb884c94955b19907d60019f4e145d091c75345379e70d1ee696f7854f" + [[package]] name = "http" version = "0.2.8" @@ -1534,12 +1701,35 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +[[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" version = "0.21.1" @@ -1582,9 +1772,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -1621,6 +1811,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "leb128" version = "0.2.5" @@ -1668,6 +1864,12 @@ dependencies = [ "cc", ] +[[package]] +name = "linked-hash-map" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" + [[package]] name = "linux-raw-sys" version = "0.1.4" @@ -1700,6 +1902,15 @@ dependencies = [ "value-bag", ] +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "malloc_buf" version = "0.0.6" @@ -1852,6 +2063,23 @@ dependencies = [ "thiserror", ] +[[package]] +name = "naga" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c3d4269bcb7d50121097702fde1afb75f4ea8083aeb7a55688dcf289a853271" +dependencies = [ + "bit-set", + "bitflags 1.3.2", + "indexmap 1.9.3", + "log", + "num-traits", + "pp-rs", + "rustc-hash", + "spirv 0.2.0+1.5.4", + "thiserror", +] + [[package]] name = "naga" version = "0.19.0" @@ -1900,6 +2128,33 @@ dependencies = [ "tempfile", ] +[[package]] +name = "ndk" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" +dependencies = [ + "bitflags 1.3.2", + "jni-sys", + "ndk-sys 0.3.0", + "num_enum 0.5.11", + "thiserror", +] + +[[package]] +name = "ndk" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" +dependencies = [ + "bitflags 1.3.2", + "jni-sys", + "ndk-sys 0.4.1+23.1.7779620", + "num_enum 0.5.11", + "raw-window-handle 0.5.2", + "thiserror", +] + [[package]] name = "ndk" version = "0.8.0" @@ -1909,8 +2164,8 @@ dependencies = [ "bitflags 2.4.2", "jni-sys", "log", - "ndk-sys", - "num_enum", + "ndk-sys 0.5.0+25.2.9519653", + "num_enum 0.7.2", "raw-window-handle 0.5.2", "raw-window-handle 0.6.0", "thiserror", @@ -1922,6 +2177,24 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" +[[package]] +name = "ndk-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" +dependencies = [ + "jni-sys", +] + +[[package]] +name = "ndk-sys" +version = "0.4.1+23.1.7779620" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" +dependencies = [ + "jni-sys", +] + [[package]] name = "ndk-sys" version = "0.5.0+25.2.9519653" @@ -1931,6 +2204,19 @@ dependencies = [ "jni-sys", ] +[[package]] +name = "nix" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" +dependencies = [ + "bitflags 1.3.2", + "cc", + "cfg-if", + "libc", + "memoffset 0.6.5", +] + [[package]] name = "nix" version = "0.26.4" @@ -1953,6 +2239,17 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.102", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -1993,13 +2290,34 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive 0.5.11", +] + [[package]] name = "num_enum" version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ - "num_enum_derive", + "num_enum_derive 0.7.2", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.102", ] [[package]] @@ -2055,6 +2373,29 @@ dependencies = [ "cc", ] +[[package]] +name = "oboe" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f63c358b4fa0fbcfefd7c8be5cfc39c08ce2389f5325687e7762a48d30a5c1" +dependencies = [ + "jni 0.19.0", + "ndk 0.6.0", + "ndk-context", + "num-derive", + "num-traits", + "oboe-sys", +] + +[[package]] +name = "oboe-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3370abb7372ed744232c12954d920d1a40f1c4686de9e79e800021ef492294bd" +dependencies = [ + "cc", +] + [[package]] name = "once_cell" version = "1.19.0" @@ -2114,6 +2455,15 @@ dependencies = [ "redox_syscall 0.3.5", ] +[[package]] +name = "ordered-float" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76df7075c7d4d01fdcb46c912dd17fba5b60c78ea480b475f2b6ab6f666584e" +dependencies = [ + "num-traits", +] + [[package]] name = "owned_ttf_parser" version = "0.19.0" @@ -2289,6 +2639,35 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22686f4785f02a4fcc856d3b3bb19bf6c8160d103f7a99cc258bddd0251dc7f2" +[[package]] +name = "pong" +version = "0.1.0" +dependencies = [ + "anyhow", + "bytemuck", + "cfg-if", + "cgmath", + "console_error_panic_hook", + "console_log", + "env_logger", + "fs_extra", + "getrandom", + "glob", + "instant", + "log", + "naga 0.11.1", + "pollster", + "rand", + "rayon", + "rodio", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu", + "wgpu_glyph", + "winit", +] + [[package]] name = "pp-rs" version = "0.2.1" @@ -2298,6 +2677,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + [[package]] name = "presser" version = "0.3.1" @@ -2348,6 +2733,36 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "range-alloc" version = "0.1.2" @@ -2492,6 +2907,16 @@ dependencies = [ "winreg", ] +[[package]] +name = "rodio" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb10b653d5ec0e9411a2e7d46e2c7f4046fd87d35b9955bd73ba4108d69072b5" +dependencies = [ + "cpal", + "hound", +] + [[package]] name = "roxmltree" version = "0.14.1" @@ -2520,6 +2945,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.36.16" @@ -2553,12 +2987,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - [[package]] name = "same-file" version = "1.0.6" @@ -2638,6 +3066,21 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.145" @@ -2681,6 +3124,21 @@ dependencies = [ "serde", ] +[[package]] +name = "sha1" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" +dependencies = [ + "sha1_smol", +] + +[[package]] +name = "sha1_smol" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" + [[package]] name = "shaderc" version = "0.8.0" @@ -2711,6 +3169,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "slab" version = "0.4.9" @@ -2832,6 +3296,55 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn 1.0.102", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn 1.0.102", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + [[package]] name = "strict-num" version = "0.1.1" @@ -3473,6 +3986,17 @@ dependencies = [ "winit", ] +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "rand", + "static_assertions", +] + [[package]] name = "unicode-bidi" version = "0.3.8" @@ -3613,9 +4137,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3623,9 +4147,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", @@ -3638,12 +4162,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-cli-support" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a875870b7b39024cbca8f61a0e1fc8edfe7ac02b484e5a9bcea64374050a850e" +checksum = "ca821da8c1ae6c87c5e94493939a206daa8587caff227c6032e0061a3d80817f" dependencies = [ "anyhow", - "base64 0.9.3", + "base64 0.21.7", "log", "rustc-demangle", "serde_json", @@ -3660,9 +4184,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-externref-xform" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c5d468dc79cfd824d181c386f34c2e7ea521ea5855ddd95af8f4cf3fa676f4" +checksum = "102582726b35a30d53157fbf8de3d0f0fed4c40c0c7951d69a034e9ef01da725" dependencies = [ "anyhow", "walrus", @@ -3682,9 +4206,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3692,9 +4216,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", @@ -3705,9 +4229,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-multi-value-xform" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65f10c037dad45759d53b598d4737acdced90a0945023c8c6cd8d67b4b3e4eaf" +checksum = "3498e4799f43523d780ceff498f04d882a8dbc9719c28020034822e5952f32a4" dependencies = [ "anyhow", "walrus", @@ -3715,15 +4239,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasm-bindgen-threads-xform" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16ddf1a4beb1bceb2b73c2325581901ca2cd92af628f24389a678854dcd65b24" +checksum = "2d5add359b7f7d09a55299a9d29be54414264f2b8cf84f8c8fda5be9269b5dd9" dependencies = [ "anyhow", "walrus", @@ -3732,9 +4256,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-wasm-conventions" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f13ed8ccdac31eadcfd4c9b2ec7bd43e77454b14acb1f43189f2875a9b0391" +checksum = "8c04e3607b810e76768260db3a5f2e8beb477cb089ef8726da85c8eb9bd3b575" dependencies = [ "anyhow", "walrus", @@ -3742,9 +4266,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-wasm-interpreter" -version = "0.2.90" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4282a271772a3063d4057c1144e118254f207fbbc1381b8d50b23c25585d893" +checksum = "9ea966593c8243a33eb4d643254eb97a69de04e89462f46cf6b4f506aae89b3a" dependencies = [ "anyhow", "log", @@ -3788,7 +4312,7 @@ checksum = "19152ddd73f45f024ed4534d9ca2594e0ef252c1847695255dae47f34df9fbe4" dependencies = [ "cc", "downcast-rs", - "nix", + "nix 0.26.4", "scoped-tls", "smallvec", "wayland-sys", @@ -3801,7 +4325,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ca7d52347346f5473bf2f56705f360e8440873052e575e55890c4fa57843ed3" dependencies = [ "bitflags 2.4.2", - "nix", + "nix 0.26.4", "wayland-backend", "wayland-scanner", ] @@ -3823,7 +4347,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44aa20ae986659d6c77d64d808a046996a932aa763913864dc40c359ef7ad5b" dependencies = [ - "nix", + "nix 0.26.4", "wayland-client", "xcursor", ] @@ -3891,9 +4415,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", @@ -3926,9 +4450,9 @@ dependencies = [ [[package]] name = "wgpu" -version = "0.19.0" +version = "0.19.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b71d2ded29e2161db50ab731d6cb42c037bd7ab94864a98fa66ff36b4721a8" +checksum = "a4b1213b52478a7631d6e387543ed8f642bc02c578ef4e3b49aca2a29a7df0cb" dependencies = [ "arrayvec", "cfg-if", @@ -4043,6 +4567,17 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wgpu_glyph" +version = "0.22.0" +source = "git+https://github.com/hecrj/wgpu_glyph.git#5d78e604dffe97aa2ec8dd65a45d19699a29bbcf" +dependencies = [ + "bytemuck", + "glyph_brush", + "log", + "wgpu", +] + [[package]] name = "widestring" version = "1.0.2" @@ -4091,6 +4626,19 @@ dependencies = [ "wgpu", ] +[[package]] +name = "windows" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647" +dependencies = [ + "windows_aarch64_msvc 0.37.0", + "windows_i686_gnu 0.37.0", + "windows_i686_msvc 0.37.0", + "windows_x86_64_gnu 0.37.0", + "windows_x86_64_msvc 0.37.0", +] + [[package]] name = "windows" version = "0.51.1" @@ -4234,6 +4782,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_aarch64_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -4258,6 +4812,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_gnu" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -4282,6 +4842,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_i686_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -4306,6 +4872,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -4348,6 +4920,12 @@ version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -4387,8 +4965,8 @@ dependencies = [ "libc", "log", "memmap2", - "ndk", - "ndk-sys", + "ndk 0.8.0", + "ndk-sys 0.5.0+25.2.9519653", "objc2", "once_cell", "orbclient", @@ -4465,6 +5043,12 @@ dependencies = [ "nom", ] +[[package]] +name = "xi-unicode" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" + [[package]] name = "xkbcommon-dl" version = "0.4.1" diff --git a/Cargo.toml b/Cargo.toml index 23f226cb..afbc30ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,5 +16,5 @@ members = [ ] exclude = [ "code/showcase/imgui-demo", - "code/showcase/pong", + #"code/showcase/pong", ] \ No newline at end of file diff --git a/code/beginner/tutorial1-window/Cargo.toml b/code/beginner/tutorial1-window/Cargo.toml index 8bcb6baf..ada46684 100644 --- a/code/beginner/tutorial1-window/Cargo.toml +++ b/code/beginner/tutorial1-window/Cargo.toml @@ -23,9 +23,9 @@ pollster = "0.3" console_error_panic_hook = "0.1.6" console_log = "1.0" wgpu = { version = "0.19", features = ["webgl"]} -wasm-bindgen = "=0.2.90" +wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4.30" -web-sys = { version = "0.3.53", features = [ +web-sys = { version = "0.3.69", features = [ "Document", "Window", "Element", diff --git a/code/beginner/tutorial1-window/src/lib.rs b/code/beginner/tutorial1-window/src/lib.rs index d8d9e30a..11ece8d8 100644 --- a/code/beginner/tutorial1-window/src/lib.rs +++ b/code/beginner/tutorial1-window/src/lib.rs @@ -27,14 +27,14 @@ pub fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/beginner/tutorial2-surface/Cargo.toml b/code/beginner/tutorial2-surface/Cargo.toml index 4aff7c23..03059fb5 100644 --- a/code/beginner/tutorial2-surface/Cargo.toml +++ b/code/beginner/tutorial2-surface/Cargo.toml @@ -12,7 +12,7 @@ cfg-if = "1" winit = { version = "0.29", features = ["rwh_05"] } env_logger = "0.10" log = "0.4" -wgpu = "0.19" +wgpu = "0.19.3" pollster = "0.3" [target.'cfg(target_arch = "wasm32")'.dependencies] diff --git a/code/beginner/tutorial2-surface/src/lib.rs b/code/beginner/tutorial2-surface/src/lib.rs index 9d038d75..b74c3b9d 100644 --- a/code/beginner/tutorial2-surface/src/lib.rs +++ b/code/beginner/tutorial2-surface/src/lib.rs @@ -175,14 +175,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + //window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/beginner/tutorial3-pipeline/src/lib.rs b/code/beginner/tutorial3-pipeline/src/lib.rs index 07454652..825a27fc 100644 --- a/code/beginner/tutorial3-pipeline/src/lib.rs +++ b/code/beginner/tutorial3-pipeline/src/lib.rs @@ -233,14 +233,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/beginner/tutorial4-buffer/src/lib.rs b/code/beginner/tutorial4-buffer/src/lib.rs index 62f286e4..289eac3e 100644 --- a/code/beginner/tutorial4-buffer/src/lib.rs +++ b/code/beginner/tutorial4-buffer/src/lib.rs @@ -311,14 +311,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/beginner/tutorial5-textures/src/lib.rs b/code/beginner/tutorial5-textures/src/lib.rs index 406ae0db..7f886405 100644 --- a/code/beginner/tutorial5-textures/src/lib.rs +++ b/code/beginner/tutorial5-textures/src/lib.rs @@ -357,14 +357,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/beginner/tutorial6-uniforms/src/lib.rs b/code/beginner/tutorial6-uniforms/src/lib.rs index 3efdca10..032aa2f2 100644 --- a/code/beginner/tutorial6-uniforms/src/lib.rs +++ b/code/beginner/tutorial6-uniforms/src/lib.rs @@ -566,14 +566,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/beginner/tutorial7-instancing/src/lib.rs b/code/beginner/tutorial7-instancing/src/lib.rs index 0ca7df31..8b39c62c 100644 --- a/code/beginner/tutorial7-instancing/src/lib.rs +++ b/code/beginner/tutorial7-instancing/src/lib.rs @@ -664,14 +664,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/beginner/tutorial8-depth/src/lib.rs b/code/beginner/tutorial8-depth/src/lib.rs index f20e9dd6..57fe7740 100644 --- a/code/beginner/tutorial8-depth/src/lib.rs +++ b/code/beginner/tutorial8-depth/src/lib.rs @@ -691,14 +691,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/beginner/tutorial9-models/src/lib.rs b/code/beginner/tutorial9-models/src/lib.rs index a45e5325..5b734f2c 100644 --- a/code/beginner/tutorial9-models/src/lib.rs +++ b/code/beginner/tutorial9-models/src/lib.rs @@ -606,14 +606,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/intermediate/tutorial10-lighting/src/lib.rs b/code/intermediate/tutorial10-lighting/src/lib.rs index 10a74661..bec2dd5d 100644 --- a/code/intermediate/tutorial10-lighting/src/lib.rs +++ b/code/intermediate/tutorial10-lighting/src/lib.rs @@ -743,13 +743,13 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); if let Some(dst) = doc.get_element_by_id("wasm-example") { dst.append_child(&canvas).ok()?; } else { diff --git a/code/intermediate/tutorial11-normals/src/lib.rs b/code/intermediate/tutorial11-normals/src/lib.rs index 393377f4..0ff5ee00 100644 --- a/code/intermediate/tutorial11-normals/src/lib.rs +++ b/code/intermediate/tutorial11-normals/src/lib.rs @@ -794,14 +794,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/intermediate/tutorial12-camera/src/lib.rs b/code/intermediate/tutorial12-camera/src/lib.rs index 2dcd9ad7..798aa685 100644 --- a/code/intermediate/tutorial12-camera/src/lib.rs +++ b/code/intermediate/tutorial12-camera/src/lib.rs @@ -697,14 +697,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/intermediate/tutorial13-hdr/src/lib.rs b/code/intermediate/tutorial13-hdr/src/lib.rs index 01360f35..5368cbb0 100644 --- a/code/intermediate/tutorial13-hdr/src/lib.rs +++ b/code/intermediate/tutorial13-hdr/src/lib.rs @@ -827,14 +827,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/intermediate/wip-terrain/src/lib.rs b/code/intermediate/wip-terrain/src/lib.rs index 4cfb6e41..f1d7d287 100644 --- a/code/intermediate/wip-terrain/src/lib.rs +++ b/code/intermediate/wip-terrain/src/lib.rs @@ -747,14 +747,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/showcase/mouse-picking/src/lib.rs b/code/showcase/mouse-picking/src/lib.rs index f6ab45df..139e919f 100644 --- a/code/showcase/mouse-picking/src/lib.rs +++ b/code/showcase/mouse-picking/src/lib.rs @@ -743,14 +743,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/showcase/pong/Cargo.toml b/code/showcase/pong/Cargo.toml index a76cec8b..4d1e78b1 100644 --- a/code/showcase/pong/Cargo.toml +++ b/code/showcase/pong/Cargo.toml @@ -16,7 +16,7 @@ bytemuck = { version = "1.12", features = [ "derive" ] } cgmath = "0.18" pollster = "0.3" wgpu = { version = "0.19", features = ["spirv"]} -wgpu_glyph = { version = "0.21", git = "https://github.com/hecrj/wgpu_glyph.git" } +wgpu_glyph = { version = "0.22", git = "https://github.com/hecrj/wgpu_glyph.git" } rand = "0.8" rodio = { version = "0.16", default-features = false, features = ["wav"] } log = "0.4" @@ -28,8 +28,8 @@ console_log = "1.0" getrandom = { version = "0.2", features = ["js"] } rodio = { version = "0.16", default-features = false, features = ["wasm-bindgen", "wav"] } wasm-bindgen-futures = "0.4.20" -wasm-bindgen = "=0.2.90" -web-sys = { version = "0.3.53", features = [ +wasm-bindgen = "0.2" +web-sys = { version = "0.3", features = [ "Document", "Window", "Element", diff --git a/code/showcase/pong/src/input.rs b/code/showcase/pong/src/input.rs index 256f84a0..6513d54c 100644 --- a/code/showcase/pong/src/input.rs +++ b/code/showcase/pong/src/input.rs @@ -1,4 +1,4 @@ -use winit::event::{ElementState, VirtualKeyCode}; +use winit::{event::ElementState, keyboard::KeyCode}; #[derive(Debug, Default)] pub struct Input { @@ -14,26 +14,26 @@ impl Input { Default::default() } - pub fn update(&mut self, key: VirtualKeyCode, state: ElementState) -> bool { + pub fn update(&mut self, key: KeyCode, state: ElementState) -> bool { let pressed = state == ElementState::Pressed; match key { - VirtualKeyCode::Up => { + KeyCode::ArrowUp => { self.p2_up_pressed = pressed; true } - VirtualKeyCode::Down => { + KeyCode::ArrowDown => { self.p2_down_pressed = pressed; true } - VirtualKeyCode::W => { + KeyCode::KeyW => { self.p1_up_pressed = pressed; true } - VirtualKeyCode::S => { + KeyCode::KeyS => { self.p1_down_pressed = pressed; true } - VirtualKeyCode::Return => { + KeyCode::Enter => { self.enter_pressed = pressed; true } diff --git a/code/showcase/pong/src/lib.rs b/code/showcase/pong/src/lib.rs index cdb8fca0..b656f93e 100644 --- a/code/showcase/pong/src/lib.rs +++ b/code/showcase/pong/src/lib.rs @@ -13,7 +13,8 @@ use wasm_bindgen::prelude::*; use winit::dpi::PhysicalSize; use winit::event::*; -use winit::event_loop::{ControlFlow, EventLoop}; +use winit::event_loop::{EventLoop, EventLoopWindowTarget}; +use winit::keyboard::{KeyCode, PhysicalKey}; use winit::window::{Fullscreen, WindowBuilder}; #[cfg_attr(target_arch = "wasm32", wasm_bindgen(start))] @@ -40,10 +41,6 @@ pub fn start() { .build(&event_loop) .unwrap(); - if window.fullscreen().is_none() { - window.set_inner_size(PhysicalSize::new(512, 512)); - } - window.set_cursor_visible(false); #[cfg(target_arch = "wasm32")] @@ -53,7 +50,7 @@ pub fn start() { .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; // Request fullscreen, if denied, continue as normal @@ -159,13 +156,9 @@ pub fn start() { log::info!("Event Loop..."); + let window = &window; + let mut last_time = instant::Instant::now(); event_loop.run(move |event, control_flow| { - *control_flow = if state.game_state == state::GameState::Quiting { - ControlFlow::Exit - } else { - ControlFlow::Poll - }; - match event { Event::WindowEvent { event: WindowEvent::CloseRequested, @@ -176,10 +169,10 @@ pub fn start() { Event::WindowEvent { event: WindowEvent::KeyboardInput { - input: - KeyboardInput { + event: + KeyEvent { state: element_state, - virtual_keycode: Some(key), + physical_key: PhysicalKey::Code(key), .. }, .. @@ -201,10 +194,13 @@ pub fn start() { render.resize(size); events.push(state::Event::Resize(size.width as f32, size.height as f32)); } - Event::RedrawEventsCleared => { + Event::WindowEvent { + event: WindowEvent::RedrawRequested, + .. + } => { + let dt = last_time.elapsed(); + last_time = instant::Instant::now(); window.request_redraw(); - } - Event::RedrawRequested(window_id) if window_id == window.id() => { for event in &events { match event { state::Event::FocusChanged | state::Event::ButtonPressed => { @@ -226,24 +222,24 @@ pub fn start() { } events.clear(); - visiblity_system.update_state(&input, &mut state, &mut events); + visiblity_system.update_state(&input, dt, &mut state, &mut events); match state.game_state { state::GameState::MainMenu => { - menu_system.update_state(&input, &mut state, &mut events); + menu_system.update_state(&input, dt, &mut state, &mut events); if state.game_state == state::GameState::Serving { serving_system.start(&mut state); } } state::GameState::Serving => { - serving_system.update_state(&input, &mut state, &mut events); - play_system.update_state(&input, &mut state, &mut events); + serving_system.update_state(&input, dt, &mut state, &mut events); + play_system.update_state(&input, dt, &mut state, &mut events); if state.game_state == state::GameState::Playing { play_system.start(&mut state); } } state::GameState::Playing => { - ball_system.update_state(&input, &mut state, &mut events); - play_system.update_state(&input, &mut state, &mut events); + ball_system.update_state(&input, dt, &mut state, &mut events); + play_system.update_state(&input, dt, &mut state, &mut events); if state.game_state == state::GameState::Serving { serving_system.start(&mut state); } else if state.game_state == state::GameState::GameOver { @@ -251,12 +247,14 @@ pub fn start() { } } state::GameState::GameOver => { - game_over_system.update_state(&input, &mut state, &mut events); + game_over_system.update_state(&input, dt, &mut state, &mut events); if state.game_state == state::GameState::MainMenu { menu_system.start(&mut state); } } - state::GameState::Quiting => {} + state::GameState::Quiting => { + control_flow.exit(); + } } render.render_state(&state); @@ -266,17 +264,17 @@ pub fn start() { } _ => {} } - }); + }).unwrap(); } fn process_input( element_state: ElementState, - keycode: VirtualKeyCode, - control_flow: &mut ControlFlow, + keycode: KeyCode, + control_flow: &EventLoopWindowTarget<()>, ) { match (keycode, element_state) { - (VirtualKeyCode::Escape, ElementState::Pressed) => { - *control_flow = ControlFlow::Exit; + (KeyCode::Escape, ElementState::Pressed) => { + control_flow.exit() } _ => {} } diff --git a/code/showcase/pong/src/render/mod.rs b/code/showcase/pong/src/render/mod.rs index f5c6d9f7..f8f8653b 100644 --- a/code/showcase/pong/src/render/mod.rs +++ b/code/showcase/pong/src/render/mod.rs @@ -12,8 +12,8 @@ use crate::state; const FONT_BYTES: &[u8] = include_bytes!("../../res/fonts/PressStart2P-Regular.ttf"); -pub struct Render { - surface: wgpu::Surface, +pub struct Render<'a> { + surface: wgpu::Surface<'a>, config: wgpu::SurfaceConfiguration, #[allow(dead_code)] adapter: wgpu::Adapter, @@ -26,7 +26,7 @@ pub struct Render { staging_belt: wgpu::util::StagingBelt, } -impl Render { +impl<'a> Render<'a> { pub fn width(&self) -> f32 { self.config.width as f32 } @@ -36,7 +36,7 @@ impl Render { self.config.height as f32 } - pub async fn new(window: &Window, size: PhysicalSize) -> Self { + pub async fn new(window: &'a Window, size: PhysicalSize) -> Render<'a> { log::warn!("size: {:?}", size); // The instance is a handle to our GPU // BackendBit::PRIMARY => Vulkan + Metal + DX12 + Browser WebGPU diff --git a/code/showcase/pong/src/system.rs b/code/showcase/pong/src/system.rs index f408c2db..6406faf3 100644 --- a/code/showcase/pong/src/system.rs +++ b/code/showcase/pong/src/system.rs @@ -9,6 +9,7 @@ pub trait System { fn update_state( &self, input: &input::Input, + dt: instant::Duration, state: &mut state::State, events: &mut Vec, ); @@ -19,6 +20,7 @@ impl System for VisibilitySystem { fn update_state( &self, _input: &input::Input, + _dt: instant::Duration, state: &mut state::State, _events: &mut Vec, ) { @@ -60,6 +62,7 @@ impl System for MenuSystem { fn update_state( &self, input: &input::Input, + _dt: instant::Duration, state: &mut state::State, events: &mut Vec, ) { @@ -92,21 +95,23 @@ impl System for PlaySystem { fn update_state( &self, input: &input::Input, + dt: instant::Duration, state: &mut state::State, _events: &mut Vec, ) { + let dt = dt.as_secs_f32(); // move the players if input.p1_up_pressed { - state.player1.position.y += util::PLAYER_SPEED; + state.player1.position.y += util::PLAYER_SPEED * dt; } if input.p1_down_pressed { - state.player1.position.y -= util::PLAYER_SPEED; + state.player1.position.y -= util::PLAYER_SPEED * dt; } if input.p2_up_pressed { - state.player2.position.y += util::PLAYER_SPEED; + state.player2.position.y += util::PLAYER_SPEED * dt; } if input.p2_down_pressed { - state.player2.position.y -= util::PLAYER_SPEED; + state.player2.position.y -= util::PLAYER_SPEED * dt; } // normalize players @@ -134,22 +139,25 @@ impl System for BallSystem { fn update_state( &self, _input: &input::Input, + dt: instant::Duration, state: &mut state::State, events: &mut Vec, ) { + let dt = dt.as_secs_f32(); + // bounce the ball off the players if state.player1.contains(&state.ball) { events.push(state::Event::BallBounce(state.ball.position)); - state.ball.position.x -= state.ball.velocity.x - state.player1.size.x; + state.ball.position.x -= state.ball.velocity.x * dt - state.player1.size.x; state.ball.velocity = util::calc_ball_velocity(&state.ball, &state.player1); } else if state.player2.contains(&state.ball) { events.push(state::Event::BallBounce(state.ball.position)); - state.ball.position.x -= state.ball.velocity.x + state.player2.size.x; + state.ball.position.x -= state.ball.velocity.x * dt + state.player2.size.x; state.ball.velocity.x *= -state.player2.size.y; state.ball.velocity = util::calc_ball_velocity(&state.ball, &state.player2); } - state.ball.position += state.ball.velocity; + state.ball.position += state.ball.velocity * dt; if state.ball.position.y > 1.0 { events.push(state::Event::BallBounce(state.ball.position)); state.ball.position.y = 1.0; @@ -199,12 +207,11 @@ impl System for ServingSystem { fn update_state( &self, _input: &input::Input, + _dt: instant::Duration, state: &mut state::State, _events: &mut Vec, ) { - let current_time = instant::Instant::now(); - let delta_time = current_time - self.last_time; - if delta_time.as_secs_f32() > 2.0 { + if self.last_time.elapsed().as_secs_f32() > 2.0 { log::info!("Serving..."); state.game_state = state::GameState::Playing; } @@ -242,12 +249,11 @@ impl System for GameOverSystem { fn update_state( &self, _input: &input::Input, + _dt: instant::Duration, state: &mut state::State, _events: &mut Vec, ) { - let current_time = instant::Instant::now(); - let delta_time = current_time - self.last_time; - if delta_time.as_secs_f32() > 1.0 { + if self.last_time.elapsed().as_secs_f32() > 1.0 { state.game_state = state::GameState::MainMenu; } } diff --git a/code/showcase/pong/src/util.rs b/code/showcase/pong/src/util.rs index d12dd879..5e63067a 100644 --- a/code/showcase/pong/src/util.rs +++ b/code/showcase/pong/src/util.rs @@ -2,8 +2,8 @@ use crate::state; -pub const PLAYER_SPEED: f32 = 0.05; -pub const BALL_SPEED: f32 = 0.025; +pub const PLAYER_SPEED: f32 = 1.5; +pub const BALL_SPEED: f32 = 1.0; const BOUNCE_ANGLE: f32 = std::f32::consts::FRAC_PI_2; diff --git a/code/showcase/threading/src/lib.rs b/code/showcase/threading/src/lib.rs index c6a183d3..258f934e 100644 --- a/code/showcase/threading/src/lib.rs +++ b/code/showcase/threading/src/lib.rs @@ -704,14 +704,14 @@ pub async fn run() { // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/code/wasm-builder/Cargo.toml b/code/wasm-builder/Cargo.toml index f06367f0..99b5e8f3 100644 --- a/code/wasm-builder/Cargo.toml +++ b/code/wasm-builder/Cargo.toml @@ -12,4 +12,4 @@ env_logger = "0.10" rayon = "1" serde = { version = "1", features = ["derive"]} serde_json = "1" -wasm-bindgen-cli-support = "0.2.86" \ No newline at end of file +wasm-bindgen-cli-support = "0.2.90" \ No newline at end of file diff --git a/code/wasm-builder/src/main.rs b/code/wasm-builder/src/main.rs index e9a889d0..7e183104 100644 --- a/code/wasm-builder/src/main.rs +++ b/code/wasm-builder/src/main.rs @@ -1,5 +1,6 @@ -use std::{path::PathBuf, process::Command}; +use std::{path::PathBuf, process::{Command, ExitStatus}}; +use anyhow::bail; use rayon::prelude::{IntoParallelRefIterator, ParallelIterator}; use wasm_bindgen_cli_support::Bindgen; @@ -37,7 +38,11 @@ fn main() -> anyhow::Result<()> { for target in &targets { command.arg("-p").arg(&target.package); } - command.spawn()?.wait()?; + let status = command.spawn()?.wait()?; + + if !status.success() { + bail!("Failed to compile WASM with code ({status})"); + } let errors = targets .par_iter() diff --git a/docs/beginner/tutorial1-window/README.md b/docs/beginner/tutorial1-window/README.md index d1e66f51..bf110930 100644 --- a/docs/beginner/tutorial1-window/README.md +++ b/docs/beginner/tutorial1-window/README.md @@ -1,9 +1,11 @@ # Dependencies and the window ## Boring, I know + Some of you reading this are very experienced with opening up windows in Rust and probably have your favorite windowing library, but this guide is designed for everybody, so it's something that we need to cover. Luckily, you don't need to read this if you know what you're doing. One thing that you do need to know is that whatever windowing solution you use needs to support the [raw-window-handle](https://github.com/rust-windowing/raw-window-handle) crate. ## What crates are we using? + For the beginner stuff, we're going to keep things very simple. We'll add things as we go, but I've listed the relevant `Cargo.toml` bits below. ```toml @@ -11,29 +13,34 @@ For the beginner stuff, we're going to keep things very simple. We'll add things winit = { version = "0.29", features = ["rwh_05"] } env_logger = "0.10" log = "0.4" -wgpu = "0.19" +wgpu = "0.19.3" ``` ## Using Rust's new resolver + As of version 0.10, wgpu requires Cargo's [newest feature resolver](https://doc.rust-lang.org/cargo/reference/resolver.html#feature-resolver-version-2), which is the default in the 2021 edition (any new project started with Rust version 1.56.0 or newer). However, if you are still using the 2018 edition, you must include `resolver = "2"` in either the `[package]` section of `Cargo.toml` if you are working on a single crate or the `[workspace]` section of the root `Cargo.toml` in a workspace. ## env_logger + It is very important to enable logging via `env_logger::init();`. When wgpu hits any error, it panics with a generic message, while logging the real error via the log crate. This means if you don't include `env_logger::init()`, wgpu will fail silently, leaving you very confused! (This has been done in the code below) ## Create a new project + run ```cargo new project_name``` where project_name is the name of the project. (In the example below, I have used 'tutorial1_window') ## The code + There's not much going on here yet, so I'm just going to post the code in full. Just paste this into your `lib.rs` or equivalent. ```rust use winit::{ event::*, - event_loop::{ControlFlow, EventLoop}, + event_loop::EventLoop, + keyboard::{KeyCode, PhysicalKey}, window::WindowBuilder, }; @@ -49,10 +56,10 @@ pub fn run() { } if window_id == window.id() => match event { WindowEvent::CloseRequested | WindowEvent::KeyboardInput { - input: - KeyboardInput { + event: + KeyEvent { state: ElementState::Pressed, - virtual_keycode: Some(VirtualKeyCode::Escape), + physical_key: PhysicalKey::Code(KeyCode::Escape), .. }, .. @@ -174,14 +181,14 @@ Next, after we create our event loop and window, we need to add a canvas to the // Winit prevents sizing with CSS, so we have to set // the size manually when on web. use winit::dpi::PhysicalSize; - window.set_inner_size(PhysicalSize::new(450, 400)); + window.request_inner_size(PhysicalSize::new(450, 400)).unwrap(); use winit::platform::web::WindowExtWebSys; web_sys::window() .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; Some(()) }) diff --git a/docs/showcase/pong/README.md b/docs/showcase/pong/README.md index 78d6317f..6acaadb6 100644 --- a/docs/showcase/pong/README.md +++ b/docs/showcase/pong/README.md @@ -281,8 +281,8 @@ console_log = "1.0" getrandom = { version = "0.2", features = ["js"] } rodio = { version = "0.15", default-features = false, features = ["wasm-bindgen", "wav"] } wasm-bindgen-futures = "0.4.20" -wasm-bindgen = "=0.2.90" -web-sys = { version = "0.3.53", features = [ +wasm-bindgen = "0.2" +web-sys = { version = "0.3", features = [ "Document", "Window", "Element", @@ -366,7 +366,7 @@ We then have to do some web-specific stuff if we are on that platform. .and_then(|win| win.document()) .and_then(|doc| { let dst = doc.get_element_by_id("wasm-example")?; - let canvas = web_sys::Element::from(window.canvas()); + let canvas = web_sys::Element::from(window.canvas()?); dst.append_child(&canvas).ok()?; // Request fullscreen, if denied, continue as normal