From 5f546a03b0f6673b1736a99bc4fd19b46f93ccd6 Mon Sep 17 00:00:00 2001 From: Joshua Coles Date: Wed, 15 Mar 2023 13:40:52 +0000 Subject: [PATCH] UI Stuff --- Cargo.lock | 1127 ++++++++++++++++++++++++++-------------------------- Cargo.toml | 2 +- src/ui.rs | 468 +++++++++++++++++++--- 3 files changed, 975 insertions(+), 622 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4490ae6..4d5760a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,6 +18,68 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" +[[package]] +name = "accesskit" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704d532b1cd3d912bb37499c55a81ac748cc1afa737eedd100ba441acdd47d38" + +[[package]] +name = "accesskit_consumer" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ba8b23cfca3944012ee2e5c71c02077a400e034c720eed6bd927cb6b4d1fd9" +dependencies = [ + "accesskit", +] + +[[package]] +name = "accesskit_macos" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc50af17818440f580a894536c4c5a95ff9e4bad59f19ee68757ca959d001813" +dependencies = [ + "accesskit", + "accesskit_consumer", + "objc2", + "once_cell", +] + +[[package]] +name = "accesskit_windows" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf5b3c3828397ee832ba4a72fb1a4ace10f781e31885f774cbd531014059115" +dependencies = [ + "accesskit", + "accesskit_consumer", + "arrayvec", + "once_cell", + "paste", + "windows 0.44.0", +] + +[[package]] +name = "accesskit_winit" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eb880d83a5502edd311bdb3af1cf7113b250c9c2d92fbdd05342c7b9f38bf51" +dependencies = [ + "accesskit", + "accesskit_macos", + "accesskit_windows", + "winit", +] + +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" @@ -46,14 +108,14 @@ dependencies = [ [[package]] name = "alsa" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5915f52fe2cf65e83924d037b6c5290b7cee097c6b5c8700746e6168a343fd6b" +checksum = "8512c9117059663fb5606788fbca3619e2a91dac0e3fe516242eab1fa6be5e44" dependencies = [ "alsa-sys", "bitflags", "libc", - "nix 0.23.2", + "nix 0.24.3", ] [[package]] @@ -66,24 +128,36 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "android-activity" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c77a0045eda8b888c76ea473c2b0515ba6f471d318f8927c5c72240937035a6" +dependencies = [ + "android-properties", + "bitflags", + "cc", + "jni-sys", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + [[package]] name = "android_log-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e" -[[package]] -name = "android_logger" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8619b80c242aa7bd638b5c7ddd952addeecb71f69c75e33f1d47b2804f8f883a" -dependencies = [ - "android_log-sys", - "env_logger", - "log", - "once_cell", -] - [[package]] name = "android_system_properties" version = "0.1.5" @@ -129,7 +203,7 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" dependencies = [ - "concurrent-queue 2.1.0", + "concurrent-queue", "event-listener", "futures-core", ] @@ -142,7 +216,7 @@ checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" dependencies = [ "async-lock", "async-task", - "concurrent-queue 2.1.0", + "concurrent-queue", "fastrand", "futures-lite", "slab", @@ -181,10 +255,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "base-x" -version = "0.2.11" +name = "backtrace" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] [[package]] name = "base64" @@ -194,18 +277,30 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "bevy" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dae99b246505811f5bc19d2de1e406ec5d2816b421d58fa223779eb576f472c9" +checksum = "cc88fece4660d68690585668f1a4e18e6dcbab160b08f337b498a96ccde91cfe" dependencies = [ "bevy_internal", ] [[package]] -name = "bevy_animation" -version = "0.9.1" +name = "bevy_a11y" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43b8073f299eb60ce9e1d60fa293b348590dd57aca8321d6859d9e7aa57d2da" +checksum = "a10b25cf04971b9d68271aa54e4601c673509db6edaf1f5359dd91fb3e84cc27" +dependencies = [ + "accesskit", + "bevy_app", + "bevy_derive", + "bevy_ecs", +] + +[[package]] +name = "bevy_animation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aabb803571785797c84e106ed63427eaf2cb12832a591923707896ee000bde8" dependencies = [ "bevy_app", "bevy_asset", @@ -221,9 +316,9 @@ dependencies = [ [[package]] name = "bevy_app" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "536e4d0018347478545ed8b6cb6e57b9279ee984868e81b7c0e78e0fb3222e42" +checksum = "960c6e444dc6a25dd51a2196f04872ae9e2e876802b66c391104849ec9225e38" dependencies = [ "bevy_derive", "bevy_ecs", @@ -236,9 +331,9 @@ dependencies = [ [[package]] name = "bevy_asset" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db1bb550168304df69c867c09125e1aae7ff51cf21575396e1598bf293442c4" +checksum = "adea538a3d166c8609621994972c31be591c96f931f160f96e74697d8c24ba45" dependencies = [ "anyhow", "bevy_app", @@ -248,11 +343,11 @@ dependencies = [ "bevy_reflect", "bevy_tasks", "bevy_utils", + "bevy_winit", "crossbeam-channel", "downcast-rs", "fastrand", "js-sys", - "ndk-glue", "notify", "parking_lot", "serde", @@ -264,25 +359,28 @@ dependencies = [ [[package]] name = "bevy_audio" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a05efc6c23bef37520e44029943c65b7e8a4fe4f5e54cb3f96e63ce0b3d361" +checksum = "0841e98276000dc06e2cf7593ee20b16b84da3bc7faa7b549938cb982b33b0e1" dependencies = [ "anyhow", "bevy_app", "bevy_asset", "bevy_ecs", + "bevy_math", "bevy_reflect", + "bevy_transform", "bevy_utils", + "oboe", "parking_lot", "rodio", ] [[package]] name = "bevy_core" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96299aceb3c8362cb4aa39ff81c7ef758a5f4e768d16b5046a91628eff114ac0" +checksum = "ed29797fa386c6969fa1e4ef9e194a27f89ddb2fa78751fe46838495d374f90f" dependencies = [ "bevy_app", "bevy_ecs", @@ -295,9 +393,9 @@ dependencies = [ [[package]] name = "bevy_core_pipeline" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc128a9860aadf16fb343ae427f2768986fd91dce64d945455acda9759c48014" +checksum = "3129d308df70dee3c46b6bb64e54d2552e7106fd3185d75732ad5e739a830fee" dependencies = [ "bevy_app", "bevy_asset", @@ -315,9 +413,9 @@ dependencies = [ [[package]] name = "bevy_derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7baf73c58d41c353c6fd08e6764a2e7420c9f19e8227b391c50981db6d0282a6" +checksum = "cdf11701c01bf4dc7a3fac9f4547f3643d3db4cc1682af40c8c86e2f8734b617" dependencies = [ "bevy_macro_utils", "quote", @@ -326,9 +424,9 @@ dependencies = [ [[package]] name = "bevy_diagnostic" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63bf96ec7980fa25b77ff6c72dfafada477936c0dab76c1edf6c028c0e5fe0e4" +checksum = "576508ffe7ad5124781edd352b79bdc79ffbb6e2f26bad6f722774f7c9fd16c9" dependencies = [ "bevy_app", "bevy_core", @@ -336,13 +434,14 @@ dependencies = [ "bevy_log", "bevy_time", "bevy_utils", + "sysinfo", ] [[package]] name = "bevy_ecs" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c071d7c6bc9801253485e05d0c257284150de755391902746837ba21c0cf74" +checksum = "fdc5b19451128091e8507c9247888359ca0bfa895e7f6ca749ccc55c5463bef6" dependencies = [ "async-channel", "bevy_ecs_macros", @@ -353,16 +452,16 @@ dependencies = [ "downcast-rs", "event-listener", "fixedbitset", - "fxhash", + "rustc-hash", "serde", "thread_local", ] [[package]] name = "bevy_ecs_macros" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15bd45438eeb681ad74f2d205bb07a5699f98f9524462a30ec764afab2742ce" +checksum = "b1e79757319533bde006a4f30c268223ec6426371297182925932075ccfdae30" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -372,9 +471,9 @@ dependencies = [ [[package]] name = "bevy_encase_derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962b6bb0d30e92ec2e6c29837acce9e55b920733a634e7c3c5fd5a514bea7a24" +checksum = "723d4838d1f88955f348294c0a9d067307f2437725400b0776e9677154914f14" dependencies = [ "bevy_macro_utils", "encase_derive_impl", @@ -382,9 +481,9 @@ dependencies = [ [[package]] name = "bevy_gilrs" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4af552dad82f854b2fae24f36a389fd8ee99d65fe86ae876e854e70d53ff16d9" +checksum = "905e547d213e368f997d08f140f4e893923c7dce4760bf0fb63401232262fa79" dependencies = [ "bevy_app", "bevy_ecs", @@ -395,9 +494,9 @@ dependencies = [ [[package]] name = "bevy_gltf" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e853e346ba412354e02292c7aa5b9a9dccdfa748e273b1b7ebf8f6a172f89712" +checksum = "bb2994d7e47c36bfe36710c4a26d3f36dd8641bfaa2c5d4d0581e001942aab6f" dependencies = [ "anyhow", "base64", @@ -424,9 +523,9 @@ dependencies = [ [[package]] name = "bevy_hierarchy" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd6d50c48c6e1bcb5e08a768b765323292bb3bf3a439b992754c57ffb85b23a" +checksum = "ccd246c862fcaeef3a769f47c6297139f971db0c8fdd6188fe9419ee8873b7e8" dependencies = [ "bevy_app", "bevy_core", @@ -439,9 +538,9 @@ dependencies = [ [[package]] name = "bevy_input" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3378b5171284f4c4c0e8307081718a9fe458f846444616bd82d69110dcabca51" +checksum = "6c809b3df62e1fcbdc6744233ae6c95a67d2cc7e518db43ab81f417d5875ba3b" dependencies = [ "bevy_app", "bevy_ecs", @@ -453,10 +552,11 @@ dependencies = [ [[package]] name = "bevy_internal" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c46014b7e885b1311de06b6039e448454a4db55b8d35464798ba88faa186e11" +checksum = "0a065c7ac81cd7cf3f1b8f15c4a93db5f07274ddaaec145ba7d0393be0c9c413" dependencies = [ + "bevy_a11y", "bevy_animation", "bevy_app", "bevy_asset", @@ -486,14 +586,13 @@ dependencies = [ "bevy_utils", "bevy_window", "bevy_winit", - "ndk-glue", ] [[package]] name = "bevy_log" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c480bac54cf4ae76edc3ae9ae3fa7c5e1b385e7f2111ef5ec3fd00cf3a7998b" +checksum = "47dcb09ec71145c80d88a84181cc1449d30f23c571bdd58c59c10eece82dfaa5" dependencies = [ "android_log-sys", "bevy_app", @@ -507,20 +606,20 @@ dependencies = [ [[package]] name = "bevy_macro_utils" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022bb69196deeea691b6997414af85bbd7f2b34a8914c4aa7a7ff4dfa44f7677" +checksum = "f24ca3363292f1435641fbafd5c24ce362137dd7d69bee56dcaaa2bc1d512ffe" dependencies = [ "quote", "syn", - "toml", + "toml_edit", ] [[package]] name = "bevy_math" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d434c77ab766c806ed9062ef8a7285b3b02b47df51f188d4496199c3ac062eaf" +checksum = "5e45e46c2ac0a92db3ae622f2ed690928fe2612e7c9470a46d0ed4c2c77e2e95" dependencies = [ "glam", "serde", @@ -528,18 +627,18 @@ dependencies = [ [[package]] name = "bevy_mikktspace" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfb5908d33fd613069be516180b8f138aaaf6e41c36b1fd98c6c29c00c24a13" +checksum = "aaa0358a79823e6f0069b910d90b615d02dad08279b5856d3d1e401472b6379a" dependencies = [ "glam", ] [[package]] name = "bevy_pbr" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310b1f260a475d81445623e138e1b7245759a42310bc1f84b550a3f4ff8763bf" +checksum = "90230c526ee7257229c1db0fc4aafaa947ea806bb4b0674785930ea59d0cc7f8" dependencies = [ "bevy_app", "bevy_asset", @@ -559,15 +658,15 @@ dependencies = [ [[package]] name = "bevy_ptr" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ec44f7655039546bc5d34d98de877083473f3e9b2b81d560c528d6d74d3eff4" +checksum = "a96c24da064370917b92c2a84527e6a73b620c50ac5ef8b1af8c04ccf5256a7c" [[package]] name = "bevy_reflect" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6deae303a7f69dc243b2fa35b5e193cc920229f448942080c8eb2dbd9de6d37a" +checksum = "ab880e0eed9df5c99ce1a2f89edc11cdef1bc78413719b29e9ad7e3bc27f4c20" dependencies = [ "bevy_math", "bevy_ptr", @@ -585,9 +684,9 @@ dependencies = [ [[package]] name = "bevy_reflect_derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bf4cb9cd5acb4193f890f36cb63679f1502e2de025e66a63b194b8b133d018" +checksum = "3b361b8671bdffe93978270dd770b03b48560c3127fdf9003f98111fb806bb11" dependencies = [ "bevy_macro_utils", "bit-set", @@ -599,11 +698,12 @@ dependencies = [ [[package]] name = "bevy_render" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e3282a8f8779d2aced93207fbed73f740937c6c2bd27bd84f0799b081c7fca5" +checksum = "52e352868ab1a9ad9fbaa6ff025505e685781ad1790377b2d038afeb9df18214" dependencies = [ "anyhow", + "async-channel", "bevy_app", "bevy_asset", "bevy_core", @@ -616,6 +716,7 @@ dependencies = [ "bevy_mikktspace", "bevy_reflect", "bevy_render_macros", + "bevy_tasks", "bevy_time", "bevy_transform", "bevy_utils", @@ -625,25 +726,27 @@ dependencies = [ "downcast-rs", "encase", "futures-lite", - "hex", "hexasphere", "image", + "ktx2", "naga", "once_cell", "parking_lot", "regex", + "ruzstd", "serde", "smallvec", "thiserror", "thread_local", "wgpu", + "wgpu-hal", ] [[package]] name = "bevy_render_macros" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7acae697776ac05bea523e1725cf2660c91c53abe72c66782ea1e1b9eedb572" +checksum = "570b1d0f38439c5ac8ab75572804c9979b9caa372c49bd00803f60a22a3e1328" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -653,9 +756,9 @@ dependencies = [ [[package]] name = "bevy_scene" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9c66a628c833d53bae54fe94cbc0d3f12c29e9d2e6c3f2356d45ad57db0c8c" +checksum = "3995f756e482e964e0244a5d388e757f272d1dcdc02136730b1c45f4d5eeb516" dependencies = [ "anyhow", "bevy_app", @@ -675,9 +778,9 @@ dependencies = [ [[package]] name = "bevy_sprite" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ec01c7db7f698d95bcb70708527c3ae6bcdc78fc247abe74f935cae8f0a1145" +checksum = "14aa41c9480b76d7b3c3f1ed89f95c9d6e2a39d3c3367ca82c122d853ac0463e" dependencies = [ "bevy_app", "bevy_asset", @@ -700,14 +803,14 @@ dependencies = [ [[package]] name = "bevy_tasks" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "680b16b53df9c9f24681dd95f4d772d83760bd19adf8bca00f358a3aad997853" +checksum = "3e368e4177fe70d695d5cb67fb7480fa262de79948d9b883a21788b9abf5a85a" dependencies = [ "async-channel", "async-executor", "async-task", - "concurrent-queue 1.2.4", + "concurrent-queue", "futures-lite", "once_cell", "wasm-bindgen-futures", @@ -715,9 +818,9 @@ dependencies = [ [[package]] name = "bevy_text" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60c74c1bdaabde7db28f6728aa13bc7b1d744a2201b2bbfd83d2224404c57f5c" +checksum = "33fc934d7cbadbb6dac11547dfb805d3e6b3f0b40f6e66e437fe4b3c7581cc5c" dependencies = [ "ab_glyph", "anyhow", @@ -738,22 +841,23 @@ dependencies = [ [[package]] name = "bevy_time" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5c38a6d3ea929c7f81e6adf5a6c62cf7e8c40f5106c2174d6057e9d8ea624d" +checksum = "d2f2863cfc08fa38909e047a1bbc2dd71d0836057ed0840c69ace9dff3e0c298" dependencies = [ "bevy_app", "bevy_ecs", "bevy_reflect", "bevy_utils", "crossbeam-channel", + "thiserror", ] [[package]] name = "bevy_transform" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba13c57a040b89767191a6f6d720a635b7792793628bfa41a9e38b7026484aec" +checksum = "de9cda3df545ac889b4f6b702109e51d29d7b4b6f402f2bb9b4d1d9f9c382b63" dependencies = [ "bevy_app", "bevy_ecs", @@ -764,10 +868,11 @@ dependencies = [ [[package]] name = "bevy_ui" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60e82ace6156f11fcdf2319102ff8fb8367b82d1e32b7d05d387a1963602f965" +checksum = "dc341d652ba20fac0170a46eff8310829a862f4e52db06164dc6200706768934" dependencies = [ + "bevy_a11y", "bevy_app", "bevy_asset", "bevy_core_pipeline", @@ -793,23 +898,37 @@ dependencies = [ [[package]] name = "bevy_utils" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16750aae52cd35bd7b60eb61cee883420b250e11b4a290b8d44b2b2941795739" +checksum = "04d90ce493910ad9af3b4220ea6864c7d1472761086a98230ecac59c8d547e95" dependencies = [ "ahash", + "bevy_utils_proc_macros", "getrandom", "hashbrown", "instant", + "petgraph", + "thiserror", "tracing", "uuid", ] [[package]] -name = "bevy_window" -version = "0.9.1" +name = "bevy_utils_proc_macros" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a44d3f3bd54a2261f4f57f614bf7bccc8d2832761493c0cd7dab81d98cc151e" +checksum = "62a42e465c446800c57a5bf65b64f4fa1c1f3a74efc2a64a2a001e4a4f548a2e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "bevy_window" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da8a2c523302ad64768991a7474c6010c76b9eb78323309ef3911521887fd108" dependencies = [ "bevy_app", "bevy_ecs", @@ -817,24 +936,29 @@ dependencies = [ "bevy_math", "bevy_reflect", "bevy_utils", - "raw-window-handle 0.5.0", + "raw-window-handle", ] [[package]] name = "bevy_winit" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7b7e647ecd0b3577468da37767dcdd7c26ca9f80da0060b2ec4c77336b6d2e1" +checksum = "8eb6eb9b9790c1ad925d900a3f315abf15b11fb56c6464747a96560e559e1a9c" dependencies = [ + "accesskit_winit", "approx", + "bevy_a11y", "bevy_app", + "bevy_derive", "bevy_ecs", + "bevy_hierarchy", "bevy_input", "bevy_math", "bevy_utils", "bevy_window", "crossbeam-channel", - "raw-window-handle 0.5.0", + "once_cell", + "raw-window-handle", "wasm-bindgen", "web-sys", "winit", @@ -887,6 +1011,25 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +[[package]] +name = "block-sys" +version = "0.1.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" +dependencies = [ + "objc-sys", +] + +[[package]] +name = "block2" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" +dependencies = [ + "block-sys", + "objc2-encode", +] + [[package]] name = "bumpalo" version = "3.12.0" @@ -925,12 +1068,6 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - [[package]] name = "cbindgen" version = "0.24.3" @@ -1058,37 +1195,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "cocoa" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" -dependencies = [ - "bitflags", - "block", - "cocoa-foundation", - "core-foundation", - "core-graphics", - "foreign-types", - "libc", - "objc", -] - -[[package]] -name = "cocoa-foundation" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" -dependencies = [ - "bitflags", - "block", - "core-foundation", - "core-graphics-types", - "foreign-types", - "libc", - "objc", -] - [[package]] name = "codespan-reporting" version = "0.11.1" @@ -1105,6 +1211,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "com-rs" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" + [[package]] name = "combine" version = "4.6.6" @@ -1115,15 +1227,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "concurrent-queue" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" -dependencies = [ - "cache-padded", -] - [[package]] name = "concurrent-queue" version = "2.1.0" @@ -1155,10 +1258,16 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.3", "libc", ] +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" + [[package]] name = "core-foundation-sys" version = "0.8.3" @@ -1192,11 +1301,12 @@ dependencies = [ [[package]] name = "coreaudio-rs" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11894b20ebfe1ff903cbdc52259693389eea03b94918a2def2c30c3bf227ad88" +checksum = "cb17e2d1795b1996419648915df94bc7103c28f7b48062d7acf4652fc371b2ff" dependencies = [ "bitflags", + "core-foundation-sys 0.6.2", "coreaudio-sys", ] @@ -1211,27 +1321,28 @@ dependencies = [ [[package]] name = "cpal" -version = "0.14.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f342c1b63e185e9953584ff2199726bf53850d96610a310e3aca09e9405a2d0b" +checksum = "d34fa7b20adf588f73f094cd9b1d944977c686e37a2759ea217ab174f017e10a" dependencies = [ "alsa", - "core-foundation-sys", + "core-foundation-sys 0.8.3", "coreaudio-rs", - "jni", + "dasp_sample", + "jni 0.19.0", "js-sys", "libc", "mach", - "ndk 0.7.0", + "ndk", "ndk-context", "oboe", "once_cell", "parking_lot", - "stdweb", "thiserror", "wasm-bindgen", + "wasm-bindgen-futures", "web-sys", - "windows 0.37.0", + "windows 0.44.0", ] [[package]] @@ -1291,9 +1402,9 @@ checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" [[package]] name = "d3d12" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827914e1f53b1e0e025ecd3d967a7836b7bcb54520f90e21ef8df7b4d88a2759" +checksum = "d8f0de2f5a8e7bd4a9eec0e3c781992a4ce1724f68aec7d7a3715344de8b39da" dependencies = [ "bitflags", "libloading", @@ -1301,45 +1412,10 @@ dependencies = [ ] [[package]] -name = "darling" -version = "0.13.4" +name = "dasp_sample" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" [[package]] name = "dispatch" @@ -1361,9 +1437,9 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "encase" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ec50086547d597b5c871a78399ec04a14828a6a5c445a61ed4687c540edec6" +checksum = "e6591f13a63571c4821802eb5b10fd1155b1290bce87086440003841c8c3909b" dependencies = [ "const_panic", "encase_derive", @@ -1373,34 +1449,24 @@ dependencies = [ [[package]] name = "encase_derive" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda93e9714c7683c474f49a461a2ae329471d2bda43c4302d41c6d8339579e92" +checksum = "4f1da6deed1f8b6f5909616ffa695f63a5de54d6a0f084fa715c70c8ed3abac9" dependencies = [ "encase_derive_impl", ] [[package]] name = "encase_derive_impl" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec27b639e942eb0297513b81cc6d87c50f6c77dc8c37af00a39ed5db3b9657ee" +checksum = "ae489d58959f3c4cdd1250866a05acfb341469affe4fced71aff3ba228be1693" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "env_logger" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" -dependencies = [ - "log", - "regex", -] - [[package]] name = "erased-serde" version = "0.3.24" @@ -1463,7 +1529,7 @@ checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "windows-sys 0.45.0", ] @@ -1596,10 +1662,16 @@ dependencies = [ ] [[package]] -name = "glam" -version = "0.22.0" +name = "gimli" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f597d56c1bd55a811a1be189459e8fad2bbc272616375602443bdfb37fa774" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" + +[[package]] +name = "glam" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e4afd9ad95555081e109fe1d21f2a30c691b5f0919c67dfa690a2e1eb6bd51c" dependencies = [ "bytemuck", "serde", @@ -1613,9 +1685,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "glow" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" +checksum = "4e007a07a24de5ecae94160f141029e9a347282cfe25d1d58d85d845cf3130f1" dependencies = [ "js-sys", "slotmap", @@ -1689,6 +1761,19 @@ dependencies = [ "bitflags", ] +[[package]] +name = "gpu-allocator" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce95f9e2e11c2c6fadfce42b5af60005db06576f231f5c92550fdded43c423e8" +dependencies = [ + "backtrace", + "log", + "thiserror", + "winapi", + "windows 0.44.0", +] + [[package]] name = "gpu-descriptor" version = "0.2.3" @@ -1719,26 +1804,6 @@ dependencies = [ "svg_fmt", ] -[[package]] -name = "hash32" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" -dependencies = [ - "byteorder", -] - -[[package]] -name = "hash32-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d2aba832b60be25c1b169146b27c64115470981b128ed84c8db18c1b03c6ff" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -1749,6 +1814,21 @@ dependencies = [ "serde", ] +[[package]] +name = "hassle-rs" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90601c6189668c7345fc53842cb3f3a3d872203d523be1b3cb44a36a3e62fb85" +dependencies = [ + "bitflags", + "com-rs", + "libc", + "libloading", + "thiserror", + "widestring", + "winapi", +] + [[package]] name = "heck" version = "0.4.1" @@ -1770,17 +1850,11 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - [[package]] name = "hexasphere" -version = "8.0.0" +version = "8.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "619ce654558681d7d0a7809e1b20249c7032ff13ee6baa7bb7ff64f7f28a906a" +checksum = "bd41d443f978bfa380a6dad58b62a08c43bcb960631f13e9d015b911eaf73588" dependencies = [ "glam", "once_cell", @@ -1792,12 +1866,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" -[[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.24.5" @@ -1867,7 +1935,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7789f7f3c9686f96164f5109d69152de759e76e284f736bd57661c6df5091919" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.3", "mach", ] @@ -1922,6 +1990,20 @@ dependencies = [ "walkdir", ] +[[package]] +name = "jni" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + [[package]] name = "jni-sys" version = "0.3.0" @@ -2000,6 +2082,15 @@ dependencies = [ "libc", ] +[[package]] +name = "ktx2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87d65e08a9ec02e409d27a0139eaa6b9756b4d81fe7cde71f6941a83730ce838" +dependencies = [ + "bitflags", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -2116,15 +2207,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "metal" version = "0.24.0" @@ -2168,9 +2250,9 @@ dependencies = [ [[package]] name = "naga" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262d2840e72dbe250e8cf2f522d080988dfca624c4112c096238a4845f591707" +checksum = "5eafe22a23b797c9bc227c6c896419b26b5bb88fa903417a3adaed08778850d5" dependencies = [ "bit-set", "bitflags", @@ -2252,19 +2334,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "ndk" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" -dependencies = [ - "bitflags", - "jni-sys", - "ndk-sys 0.3.0", - "num_enum", - "thiserror", -] - [[package]] name = "ndk" version = "0.7.0" @@ -2273,9 +2342,9 @@ checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ "bitflags", "jni-sys", - "ndk-sys 0.4.1+23.1.7779620", + "ndk-sys", "num_enum", - "raw-window-handle 0.5.0", + "raw-window-handle", "thiserror", ] @@ -2285,45 +2354,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" -[[package]] -name = "ndk-glue" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" -dependencies = [ - "android_logger", - "libc", - "log", - "ndk 0.7.0", - "ndk-context", - "ndk-macro", - "ndk-sys 0.4.1+23.1.7779620", - "once_cell", - "parking_lot", -] - -[[package]] -name = "ndk-macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" -dependencies = [ - "darling", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[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" @@ -2335,15 +2365,13 @@ dependencies = [ [[package]] name = "nix" -version = "0.23.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags", - "cc", "cfg-if", "libc", - "memoffset", ] [[package]] @@ -2386,6 +2414,15 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "ntapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc51db7b362b205941f71232e56c625156eb9a929f8cf74a428fd5bc094a4afc" +dependencies = [ + "winapi", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -2477,6 +2514,32 @@ dependencies = [ "objc_exception", ] +[[package]] +name = "objc-sys" +version = "0.2.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" + +[[package]] +name = "objc2" +version = "0.3.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe31e5425d3d0b89a15982c024392815da40689aceb34bad364d58732bcfd649" +dependencies = [ + "block2", + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2-encode" +version = "2.0.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" +dependencies = [ + "objc-sys", +] + [[package]] name = "objc_exception" version = "0.1.2" @@ -2487,13 +2550,22 @@ dependencies = [ ] [[package]] -name = "oboe" -version = "0.4.6" +name = "object" +version = "0.30.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f63c358b4fa0fbcfefd7c8be5cfc39c08ce2389f5325687e7762a48d30a5c1" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" dependencies = [ - "jni", - "ndk 0.6.0", + "memchr", +] + +[[package]] +name = "oboe" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8868cc237ee02e2d9618539a23a8d228b9bb3fc2e7a5b11eed3831de77c395d0" +dependencies = [ + "jni 0.20.0", + "ndk", "ndk-context", "num-derive", "num-traits", @@ -2502,9 +2574,9 @@ dependencies = [ [[package]] name = "oboe-sys" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3370abb7372ed744232c12954d920d1a40f1c4686de9e79e800021ef492294bd" +checksum = "7f44155e7fb718d3cfddcf70690b2b51ac4412f347cd9e4fbe511abe9cd7b5f2" dependencies = [ "cc", ] @@ -2524,6 +2596,18 @@ version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +[[package]] +name = "orbclient" +version = "0.3.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "974465c5e83cf9df05c1e4137b271d29035c902e39e5ad4c1939837e22160af8" +dependencies = [ + "cfg-if", + "redox_syscall 0.2.16", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "ordered-float" version = "3.4.0" @@ -2578,7 +2662,7 @@ checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "windows-sys 0.45.0", ] @@ -2756,15 +2840,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" -[[package]] -name = "raw-window-handle" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" -dependencies = [ - "cty", -] - [[package]] name = "raw-window-handle" version = "0.5.0" @@ -2795,6 +2870,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb02a9aee8e8c7ad8d86890f1e16b49e0bbbffc9961ff3788c31d57c98bcbf03" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" version = "1.7.1" @@ -2829,9 +2913,9 @@ checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157" [[package]] name = "rodio" -version = "0.16.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb10b653d5ec0e9411a2e7d46e2c7f4046fd87d35b9955bd73ba4108d69072b5" +checksum = "bdf1d4dea18dff2e9eb6dca123724f8b60ef44ad74a9ad283cdfe025df7e73fa" dependencies = [ "cpal", "lewton", @@ -2868,21 +2952,18 @@ dependencies = [ "serde_json", ] +[[package]] +name = "rustc-demangle" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" + [[package]] name = "rustc-hash" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" -[[package]] -name = "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.8" @@ -2897,6 +2978,16 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "ruzstd" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cada0ef59efa6a5f4dc5e491f93d9f31e3fc7758df421ff1de8a706338e1100" +dependencies = [ + "byteorder", + "twox-hash", +] + [[package]] name = "ryu" version = "1.0.12" @@ -2933,21 +3024,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[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.152" @@ -2979,21 +3055,6 @@ 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 = "sharded-slab" version = "0.1.4" @@ -3078,55 +3139,6 @@ 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", -] - -[[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", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "strsim" version = "0.10.0" @@ -3151,16 +3163,28 @@ dependencies = [ ] [[package]] -name = "taffy" -version = "0.1.0" +name = "sysinfo" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec27dea659b100d489dffa57cf0efc6d7bfefb119af817b92cc14006c0b214e3" +checksum = "d3e847e2de7a137c8c2cede5095872dbb00f4f9bf34d061347e36b43322acd56" +dependencies = [ + "cfg-if", + "core-foundation-sys 0.8.3", + "libc", + "ntapi", + "once_cell", + "winapi", +] + +[[package]] +name = "taffy" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee314c07429e51c4770287734f62d23bb27cb9e941823f969b57f50171079ee" dependencies = [ "arrayvec", - "hash32", - "hash32-derive", "num-traits", - "typenum", + "slotmap", ] [[package]] @@ -3171,7 +3195,7 @@ checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", + "redox_syscall 0.2.16", "rustix", "windows-sys 0.42.0", ] @@ -3341,6 +3365,16 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0609f771ad9c6155384897e1df4d948e692667cc0588548b68eb44d052b27633" +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + [[package]] name = "typenum" version = "1.16.0" @@ -3488,6 +3522,17 @@ version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +[[package]] +name = "wayland-scanner" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" +dependencies = [ + "proc-macro2", + "quote", + "xml-rs", +] + [[package]] name = "web-sys" version = "0.3.61" @@ -3500,16 +3545,18 @@ dependencies = [ [[package]] name = "wgpu" -version = "0.14.2" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f643110d228fd62a60c5ed2ab56c4d5b3704520bd50561174ec4ec74932937" +checksum = "d745a1b6d91d85c33defbb29f0eee0450e1d2614d987e14bf6baf26009d132d7" dependencies = [ "arrayvec", + "cfg-if", "js-sys", "log", "naga", "parking_lot", - "raw-window-handle 0.5.0", + "profiling", + "raw-window-handle", "smallvec", "static_assertions", "wasm-bindgen", @@ -3522,21 +3569,20 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.14.2" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6000d1284ef8eec6076fd5544a73125fd7eb9b635f18dceeb829d826f41724ca" +checksum = "7131408d940e335792645a98f03639573b0480e9e2e7cddbbab74f7c6d9f3fff" dependencies = [ "arrayvec", "bit-vec", "bitflags", - "cfg_aliases", "codespan-reporting", "fxhash", "log", "naga", "parking_lot", "profiling", - "raw-window-handle 0.5.0", + "raw-window-handle", "smallvec", "thiserror", "web-sys", @@ -3546,9 +3592,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.14.1" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc320a61acb26be4f549c9b1b53405c10a223fbfea363ec39474c32c348d12f" +checksum = "7762ae7fcc06943c1b5d4987ab0194e82aaba7767fbfb75d3458844c5b82cc45" dependencies = [ "android_system_properties", "arrayvec", @@ -3562,9 +3608,12 @@ dependencies = [ "fxhash", "glow", "gpu-alloc", + "gpu-allocator", "gpu-descriptor", + "hassle-rs", "js-sys", "khronos-egl", + "libc", "libloading", "log", "metal", @@ -3573,7 +3622,7 @@ dependencies = [ "parking_lot", "profiling", "range-alloc", - "raw-window-handle 0.5.0", + "raw-window-handle", "renderdoc-sys", "smallvec", "thiserror", @@ -3585,11 +3634,13 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.14.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb6b28ef22cac17b9109b25b3bf8c9a103eeb293d7c5f78653979b09140375f6" +checksum = "32444e121b0bd00cb02c0de32fde457a9491bd44e03e7a5db6df9b1da2f6f110" dependencies = [ "bitflags", + "js-sys", + "web-sys", ] [[package]] @@ -3602,6 +3653,12 @@ dependencies = [ "safe_arch", ] +[[package]] +name = "widestring" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" + [[package]] name = "winapi" version = "0.3.9" @@ -3633,19 +3690,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[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.43.0" @@ -3653,25 +3697,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_x86_64_msvc", ] [[package]] -name = "windows-sys" -version = "0.36.1" +name = "windows" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", + "windows-implement", + "windows-interface", + "windows-targets", +] + +[[package]] +name = "windows-implement" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce87ca8e3417b02dc2a8a22769306658670ec92d78f1bd420d6310a67c245c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "853f69a591ecd4f810d29f17e902d40e349fb05b0b11fff63b08b826bfe39c7f" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -3681,12 +3745,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_x86_64_msvc", ] [[package]] @@ -3705,12 +3769,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_x86_64_msvc", ] [[package]] @@ -3719,72 +3783,24 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" - [[package]] name = "windows_aarch64_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" - [[package]] name = "windows_i686_gnu" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" - [[package]] name = "windows_i686_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" - [[package]] name = "windows_x86_64_gnu" version = "0.42.1" @@ -3797,18 +3813,6 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" - [[package]] name = "windows_x86_64_msvc" version = "0.42.1" @@ -3817,12 +3821,13 @@ checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "winit" -version = "0.27.5" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb796d6fbd86b2fd896c9471e6f04d39d750076ebe5680a3958f00f5ab97657c" +checksum = "9d38e7dc904dda347b54dbec3b2d4bf534794f4fb4e6df0be91a264f4f2ed1cf" dependencies = [ + "android-activity", "bitflags", - "cocoa", + "cfg_aliases", "core-foundation", "core-graphics", "dispatch", @@ -3830,17 +3835,17 @@ dependencies = [ "libc", "log", "mio", - "ndk 0.7.0", - "ndk-glue", - "objc", + "ndk", + "objc2", "once_cell", - "parking_lot", + "orbclient", "percent-encoding", - "raw-window-handle 0.4.3", - "raw-window-handle 0.5.0", + "raw-window-handle", + "redox_syscall 0.3.4", "wasm-bindgen", + "wayland-scanner", "web-sys", - "windows-sys 0.36.1", + "windows-sys 0.45.0", "x11-dl", ] @@ -3869,3 +3874,9 @@ name = "xi-unicode" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" + +[[package]] +name = "xml-rs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" diff --git a/Cargo.toml b/Cargo.toml index 5aa1a53..4d5c15d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ opt-level = 3 [dependencies] clap = { version = "4.1.8", features = ["derive"] } -bevy = { version = "0.9.1" } +bevy = { version = "0.10.0" } nd_array = "0.1.0" num-integer = "0.1.45" rand = { version = "0.8.5", features = ["default", "small_rng"] } diff --git a/src/ui.rs b/src/ui.rs index 54872f0..e73bd94 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -1,82 +1,424 @@ -#![feature(array_zip)] +//! A simplified implementation of the classic game "Breakout". -mod system; +use bevy::{ + prelude::*, + sprite::collide_aabb::{collide, Collision}, + sprite::MaterialMesh2dBundle, + app::CoreSchedule, +}; -use std::default::Default; -use std::error::Error; -use bevy::{prelude::*, sprite::MaterialMesh2dBundle}; -use csv::{Position, Reader, ReaderBuilder}; -use clap::Parser; -use itertools::Itertools; -use crate::system::spaces::square_grid::Grid2D; +// Defines the amount of time that should elapse between each physics step. +const TIME_STEP: f32 = 1.0 / 60.0; -#[derive(Parser, Resource)] // requires `derive` feature -enum UICli { - CSV(CSVArgs) -} +// These constants are defined in `Transform` units. +// Using the default 2D camera they correspond 1:1 with screen pixels. +const PADDLE_SIZE: Vec3 = Vec3::new(120.0, 20.0, 0.0); +const GAP_BETWEEN_PADDLE_AND_FLOOR: f32 = 60.0; +const PADDLE_SPEED: f32 = 500.0; +// How close can the paddle get to the wall +const PADDLE_PADDING: f32 = 10.0; -#[derive(clap::Args)] -struct CSVArgs { - path: std::path::PathBuf, -} +// We set the z-value of the ball to 1 so it renders on top in the case of overlapping sprites. +const BALL_STARTING_POSITION: Vec3 = Vec3::new(0.0, -50.0, 1.0); +const BALL_SIZE: Vec3 = Vec3::new(30.0, 30.0, 0.0); +const BALL_SPEED: f32 = 400.0; +const INITIAL_BALL_DIRECTION: Vec2 = Vec2::new(0.5, -0.5); -fn main() -> Result<(), Box> { - let cli = UICli::parse(); +const WALL_THICKNESS: f32 = 10.0; +// x coordinates +const LEFT_WALL: f32 = -450.; +const RIGHT_WALL: f32 = 450.; +// y coordinates +const BOTTOM_WALL: f32 = -300.; +const TOP_WALL: f32 = 300.; +const BRICK_SIZE: Vec2 = Vec2::new(100., 30.); +// These values are exact +const GAP_BETWEEN_PADDLE_AND_BRICKS: f32 = 270.0; +const GAP_BETWEEN_BRICKS: f32 = 5.0; +// These values are lower bounds, as the number of bricks is computed +const GAP_BETWEEN_BRICKS_AND_CEILING: f32 = 20.0; +const GAP_BETWEEN_BRICKS_AND_SIDES: f32 = 20.0; + +const SCOREBOARD_FONT_SIZE: f32 = 40.0; +const SCOREBOARD_TEXT_PADDING: Val = Val::Px(5.0); + +const BACKGROUND_COLOR: Color = Color::rgb(0.9, 0.9, 0.9); +const PADDLE_COLOR: Color = Color::rgb(0.3, 0.3, 0.7); +const BALL_COLOR: Color = Color::rgb(1.0, 0.5, 0.5); +const BRICK_COLOR: Color = Color::rgb(0.5, 0.5, 1.0); +const WALL_COLOR: Color = Color::rgb(0.8, 0.8, 0.8); +const TEXT_COLOR: Color = Color::rgb(0.5, 0.5, 1.0); +const SCORE_COLOR: Color = Color::rgb(1.0, 0.5, 0.5); + +fn main() { App::new() - .insert_resource(cli) - .add_plugins(DefaultPlugins.set(WindowPlugin { - window: WindowDescriptor { - title: "DLA Static 2D Render".to_string(), - width: 800., - height: 800., - ..default() - }, - ..default() - })) - .add_startup_system(setup_ui) - .add_startup_system(read_csv) + .add_plugins(DefaultPlugins) + .insert_resource(StatusCounter { size: 0, fd: 0.0 }) + .insert_resource(ClearColor(BACKGROUND_COLOR)) + .add_startup_system(setup) + .add_event::() + // Add our gameplay simulation systems to the fixed timestep schedule + .add_systems( + ( + check_for_collisions, + apply_velocity.before(check_for_collisions), + move_paddle + .before(check_for_collisions) + .after(apply_velocity), + play_collision_sound.after(check_for_collisions), + ) + .in_schedule(CoreSchedule::FixedUpdate), + ) + // Configure how frequently our gameplay systems are run + .insert_resource(FixedTime::new_from_secs(TIME_STEP)) + .add_system(update_scoreboard) + .add_system(bevy::window::close_on_esc) .run(); - - Ok(()) } -fn read_csv( - cli: Res, - mut commands: Commands -) { - let csv_path = match &cli.into_inner() { - UICli::CSV(CSVArgs { path }) => path, - _ => panic!("Ahh"), - }; +#[derive(Component)] +struct Paddle; - let mut reader = ReaderBuilder::new() - .has_headers(true) - .from_path(csv_path) - .expect("Failed to read csv"); +#[derive(Component)] +struct Ball; - let positions = reader - .deserialize() - .collect::, _>>() - .expect("Failed to parse csv"); +#[derive(Component, Deref, DerefMut)] +struct Velocity(Vec2); - for Grid2D { x, y } in positions { - let rect_size = 2.0; +#[derive(Component)] +struct Collider; - commands.spawn(SpriteBundle { - sprite: Sprite { - color: Color::rgb(0.25, 0.25, 0.75), - custom_size: Some(Vec2::new(rect_size, rect_size)), - ..default() - }, - transform: Transform::from_translation(Vec3::new((x as f32) * rect_size, (y as f32) * rect_size, 0.)), - ..default() - }); +#[derive(Default)] +struct CollisionEvent; + +#[derive(Component)] +struct Brick; + +#[derive(Resource)] +struct CollisionSound(Handle); + +// This bundle is a collection of the components that define a "wall" in our game +#[derive(Bundle)] +struct WallBundle { + // You can nest bundles inside of other bundles like this + // Allowing you to compose their functionality + sprite_bundle: SpriteBundle, + collider: Collider, +} + +/// Which side of the arena is this wall located on? +enum WallLocation { + Left, + Right, + Bottom, + Top, +} + +impl WallLocation { + fn position(&self) -> Vec2 { + match self { + WallLocation::Left => Vec2::new(LEFT_WALL, 0.), + WallLocation::Right => Vec2::new(RIGHT_WALL, 0.), + WallLocation::Bottom => Vec2::new(0., BOTTOM_WALL), + WallLocation::Top => Vec2::new(0., TOP_WALL), + } + } + + fn size(&self) -> Vec2 { + let arena_height = TOP_WALL - BOTTOM_WALL; + let arena_width = RIGHT_WALL - LEFT_WALL; + // Make sure we haven't messed up our constants + assert!(arena_height > 0.0); + assert!(arena_width > 0.0); + + match self { + WallLocation::Left | WallLocation::Right => { + Vec2::new(WALL_THICKNESS, arena_height + WALL_THICKNESS) + } + WallLocation::Bottom | WallLocation::Top => { + Vec2::new(arena_width + WALL_THICKNESS, WALL_THICKNESS) + } + } } } -fn setup_ui( +impl WallBundle { + // This "builder method" allows us to reuse logic across our wall entities, + // making our code easier to read and less prone to bugs when we change the logic + fn new(location: WallLocation) -> WallBundle { + WallBundle { + sprite_bundle: SpriteBundle { + transform: Transform { + // We need to convert our Vec2 into a Vec3, by giving it a z-coordinate + // This is used to determine the order of our sprites + translation: location.position().extend(0.0), + // The z-scale of 2D objects must always be 1.0, + // or their ordering will be affected in surprising ways. + // See https://github.com/bevyengine/bevy/issues/4149 + scale: location.size().extend(1.0), + ..default() + }, + sprite: Sprite { + color: WALL_COLOR, + ..default() + }, + ..default() + }, + collider: Collider, + } + } +} + +// This resource tracks the game's score +#[derive(Resource)] +struct StatusCounter { + size: usize, + fd: f32, +} + +// Add the game's entities to our world +fn setup( mut commands: Commands, + mut meshes: ResMut>, + mut materials: ResMut>, + asset_server: Res, ) { - commands.spawn(Camera2dBundle::new_with_far(1000.0)); -} \ No newline at end of file + // Camera + commands.spawn(Camera2dBundle::default()); + + // Sound + let ball_collision_sound = asset_server.load("sounds/breakout_collision.ogg"); + commands.insert_resource(CollisionSound(ball_collision_sound)); + + // Paddle + let paddle_y = BOTTOM_WALL + GAP_BETWEEN_PADDLE_AND_FLOOR; + + commands.spawn(( + SpriteBundle { + transform: Transform { + translation: Vec3::new(0.0, paddle_y, 0.0), + scale: PADDLE_SIZE, + ..default() + }, + sprite: Sprite { + color: PADDLE_COLOR, + ..default() + }, + ..default() + }, + Paddle, + Collider, + )); + + // Ball + commands.spawn(( + MaterialMesh2dBundle { + mesh: meshes.add(shape::Circle::default().into()).into(), + material: materials.add(ColorMaterial::from(BALL_COLOR)), + transform: Transform::from_translation(BALL_STARTING_POSITION).with_scale(BALL_SIZE), + ..default() + }, + Ball, + Velocity(INITIAL_BALL_DIRECTION.normalize() * BALL_SPEED), + )); + + // Scoreboard + commands.spawn( + TextBundle::from_sections([ + TextSection::new( + "Score: ", + TextStyle { + font: asset_server.load("fonts/FiraSans-Bold.ttf"), + font_size: SCOREBOARD_FONT_SIZE, + color: TEXT_COLOR, + }, + ), + TextSection::from_style(TextStyle { + font: asset_server.load("fonts/FiraMono-Medium.ttf"), + font_size: SCOREBOARD_FONT_SIZE, + color: SCORE_COLOR, + }), + ]) + .with_style(Style { + position_type: PositionType::Absolute, + position: UiRect { + top: SCOREBOARD_TEXT_PADDING, + left: SCOREBOARD_TEXT_PADDING, + ..default() + }, + ..default() + }), + ); + + // Walls + commands.spawn(WallBundle::new(WallLocation::Left)); + commands.spawn(WallBundle::new(WallLocation::Right)); + commands.spawn(WallBundle::new(WallLocation::Bottom)); + commands.spawn(WallBundle::new(WallLocation::Top)); + + // Bricks + // Negative scales result in flipped sprites / meshes, + // which is definitely not what we want here + assert!(BRICK_SIZE.x > 0.0); + assert!(BRICK_SIZE.y > 0.0); + + let total_width_of_bricks = (RIGHT_WALL - LEFT_WALL) - 2. * GAP_BETWEEN_BRICKS_AND_SIDES; + let bottom_edge_of_bricks = paddle_y + GAP_BETWEEN_PADDLE_AND_BRICKS; + let total_height_of_bricks = TOP_WALL - bottom_edge_of_bricks - GAP_BETWEEN_BRICKS_AND_CEILING; + + assert!(total_width_of_bricks > 0.0); + assert!(total_height_of_bricks > 0.0); + + // Given the space available, compute how many rows and columns of bricks we can fit + let n_columns = (total_width_of_bricks / (BRICK_SIZE.x + GAP_BETWEEN_BRICKS)).floor() as usize; + let n_rows = (total_height_of_bricks / (BRICK_SIZE.y + GAP_BETWEEN_BRICKS)).floor() as usize; + let n_vertical_gaps = n_columns - 1; + + // Because we need to round the number of columns, + // the space on the top and sides of the bricks only captures a lower bound, not an exact value + let center_of_bricks = (LEFT_WALL + RIGHT_WALL) / 2.0; + let left_edge_of_bricks = center_of_bricks + // Space taken up by the bricks + - (n_columns as f32 / 2.0 * BRICK_SIZE.x) + // Space taken up by the gaps + - n_vertical_gaps as f32 / 2.0 * GAP_BETWEEN_BRICKS; + + // In Bevy, the `translation` of an entity describes the center point, + // not its bottom-left corner + let offset_x = left_edge_of_bricks + BRICK_SIZE.x / 2.; + let offset_y = bottom_edge_of_bricks + BRICK_SIZE.y / 2.; + + for row in 0..n_rows { + for column in 0..n_columns { + let brick_position = Vec2::new( + offset_x + column as f32 * (BRICK_SIZE.x + GAP_BETWEEN_BRICKS), + offset_y + row as f32 * (BRICK_SIZE.y + GAP_BETWEEN_BRICKS), + ); + + // brick + commands.spawn(( + SpriteBundle { + sprite: Sprite { + color: BRICK_COLOR, + ..default() + }, + transform: Transform { + translation: brick_position.extend(0.0), + scale: Vec3::new(BRICK_SIZE.x, BRICK_SIZE.y, 1.0), + ..default() + }, + ..default() + }, + Brick, + Collider, + )); + } + } +} + +fn move_paddle( + keyboard_input: Res>, + mut query: Query<&mut Transform, With>, +) { + let mut paddle_transform = query.single_mut(); + let mut direction = 0.0; + + if keyboard_input.pressed(KeyCode::Left) { + direction -= 1.0; + } + + if keyboard_input.pressed(KeyCode::Right) { + direction += 1.0; + } + + // Calculate the new horizontal paddle position based on player input + let new_paddle_position = paddle_transform.translation.x + direction * PADDLE_SPEED * TIME_STEP; + + // Update the paddle position, + // making sure it doesn't cause the paddle to leave the arena + let left_bound = LEFT_WALL + WALL_THICKNESS / 2.0 + PADDLE_SIZE.x / 2.0 + PADDLE_PADDING; + let right_bound = RIGHT_WALL - WALL_THICKNESS / 2.0 - PADDLE_SIZE.x / 2.0 - PADDLE_PADDING; + + paddle_transform.translation.x = new_paddle_position.clamp(left_bound, right_bound); +} + +fn apply_velocity(mut query: Query<(&mut Transform, &Velocity)>) { + for (mut transform, velocity) in &mut query { + transform.translation.x += velocity.x * TIME_STEP; + transform.translation.y += velocity.y * TIME_STEP; + } +} + +fn update_scoreboard(scoreboard: Res, mut query: Query<&mut Text>) { + let mut text = query.single_mut(); + text.sections[1].value = scoreboard.size.to_string(); +} + +fn check_for_collisions( + mut commands: Commands, + mut scoreboard: ResMut, + mut ball_query: Query<(&mut Velocity, &Transform), With>, + collider_query: Query<(Entity, &Transform, Option<&Brick>), With>, + mut collision_events: EventWriter, +) { + let (mut ball_velocity, ball_transform) = ball_query.single_mut(); + let ball_size = ball_transform.scale.truncate(); + + // check collision with walls + for (collider_entity, transform, maybe_brick) in &collider_query { + let collision = collide( + ball_transform.translation, + ball_size, + transform.translation, + transform.scale.truncate(), + ); + if let Some(collision) = collision { + // Sends a collision event so that other systems can react to the collision + collision_events.send_default(); + + // Bricks should be despawned and increment the scoreboard on collision + if maybe_brick.is_some() { + scoreboard.size += 1; + commands.entity(collider_entity).despawn(); + } + + // reflect the ball when it collides + let mut reflect_x = false; + let mut reflect_y = false; + + // only reflect if the ball's velocity is going in the opposite direction of the + // collision + match collision { + Collision::Left => reflect_x = ball_velocity.x > 0.0, + Collision::Right => reflect_x = ball_velocity.x < 0.0, + Collision::Top => reflect_y = ball_velocity.y < 0.0, + Collision::Bottom => reflect_y = ball_velocity.y > 0.0, + Collision::Inside => { /* do nothing */ } + } + + // reflect velocity on the x-axis if we hit something on the x-axis + if reflect_x { + ball_velocity.x = -ball_velocity.x; + } + + // reflect velocity on the y-axis if we hit something on the y-axis + if reflect_y { + ball_velocity.y = -ball_velocity.y; + } + } + } +} + +fn play_collision_sound( + mut collision_events: EventReader, + audio: Res