From c27cfdbb221b8734350feb8dcebd169a845f0a71 Mon Sep 17 00:00:00 2001 From: Schrottkatze Date: Sun, 24 Nov 2024 18:19:44 +0100 Subject: [PATCH] add story shit --- .cargo/config.toml | 8 +- Cargo.lock | 1086 +------------------------------------------- Cargo.toml | 2 +- src/game.rs | 2 +- src/game/player.rs | 3 +- src/game/scene.rs | 3 +- src/main.rs | 114 ++++- 7 files changed, 133 insertions(+), 1085 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 216ddda..96c291a 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,6 +1,6 @@ [target.x86_64-unknown-linux-gnu] -linker = "clang" -rustflags = [ - "-C", "link-arg=-fuse-ld=mold", -] +# linker = "clang" +# rustflags = [ +# "-C", "link-arg=-fuse-ld=mold", +# ] diff --git a/Cargo.lock b/Cargo.lock index d638b4d..a9cf95e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -181,24 +181,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "arboard" -version = "3.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df099ccb16cd014ff054ac1bf392c67feeef57164b05c42f037cd40f5d4357f4" -dependencies = [ - "clipboard-win", - "core-graphics", - "image 0.25.5", - "log", - "objc2", - "objc2-app-kit", - "objc2-foundation", - "parking_lot", - "windows-sys 0.48.0", - "x11rb", -] - [[package]] name = "arrayref" version = "0.3.9" @@ -322,50 +304,6 @@ dependencies = [ "bevy_internal", ] -[[package]] -name = "bevy-inspector-egui" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d46ba955761969dbc9a79d3583a175609b4e370303bc0f9a5846397dcb7f05fd" -dependencies = [ - "bevy-inspector-egui-derive", - "bevy_app", - "bevy_asset", - "bevy_color", - "bevy_core", - "bevy_core_pipeline", - "bevy_ecs", - "bevy_egui", - "bevy_hierarchy", - "bevy_log", - "bevy_math", - "bevy_pbr", - "bevy_reflect", - "bevy_render", - "bevy_state", - "bevy_time", - "bevy_utils", - "bevy_window", - "bytemuck", - "egui", - "fuzzy-matcher", - "image 0.24.9", - "once_cell", - "pretty-type-name", - "smallvec", -] - -[[package]] -name = "bevy-inspector-egui-derive" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06683f27065a27065ef8cebe77d7b347c9d0511a091deafd6dd77c5535434934" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - [[package]] name = "bevy_a11y" version = "0.14.2" @@ -603,70 +541,6 @@ dependencies = [ "syn 2.0.89", ] -[[package]] -name = "bevy_editor_pls" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7d2efb3d009000d12a5313025caaeb3cdd21d417ff5dc9f03df07a26835a49f" -dependencies = [ - "bevy", - "bevy_editor_pls_core", - "bevy_editor_pls_default_windows", - "egui", - "transform-gizmo-bevy", -] - -[[package]] -name = "bevy_editor_pls_core" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91172dff3c376a89e258e7d1fd54cc54da4cecb054699467e4045a8cab7af8eb" -dependencies = [ - "bevy", - "bevy-inspector-egui", - "egui_dock", - "indexmap", -] - -[[package]] -name = "bevy_editor_pls_default_windows" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "045f52ce978be49e27f9c1c627f20d3273cf889d8ebbe977736d68011d95c792" -dependencies = [ - "bevy", - "bevy-inspector-egui", - "bevy_editor_pls_core", - "bevy_mod_debugdump", - "indexmap", - "opener", - "pretty-type-name", - "transform-gizmo-bevy", -] - -[[package]] -name = "bevy_egui" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128438a8163e49528207aabf20d3ff0890fd6be0f0054626915995efac87922b" -dependencies = [ - "arboard", - "bevy", - "bytemuck", - "console_log", - "crossbeam-channel", - "egui", - "js-sys", - "log", - "thread_local", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webbrowser", - "wgpu-types", - "winit", -] - [[package]] name = "bevy_encase_derive" version = "0.14.2" @@ -862,7 +736,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5421792749dda753ab3718e77d27bfce38443daf1850b836b97530b6245a4581" dependencies = [ "bevy_reflect", - "glam 0.27.0", + "glam", "rand", "serde", "smallvec", @@ -875,24 +749,7 @@ version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "66cf695a264b043f2c4edb92dd5c742e6892180d2b30dac870012d153f8557ea" dependencies = [ - "glam 0.27.0", -] - -[[package]] -name = "bevy_mod_debugdump" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30f0eab3099d7d474b25a95a6a2a945e6089d75e099af5a571fe896f7c1a455b" -dependencies = [ - "bevy_app", - "bevy_color", - "bevy_ecs", - "bevy_render", - "bevy_utils", - "lexopt", - "once_cell", - "petgraph", - "pretty-type-name", + "glam", ] [[package]] @@ -952,7 +809,7 @@ dependencies = [ "bevy_utils", "downcast-rs", "erased-serde", - "glam 0.27.0", + "glam", "petgraph", "serde", "smallvec", @@ -1006,7 +863,7 @@ dependencies = [ "encase", "futures-lite", "hexasphere", - "image 0.25.5", + "image", "js-sys", "ktx2", "naga", @@ -1359,17 +1216,6 @@ dependencies = [ "piper", ] -[[package]] -name = "bstr" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a68f1f47cdf0ec8ee4b941b2eee2a80cb796db73118c0dd09ac63fbe405be22" -dependencies = [ - "memchr", - "regex-automata 0.4.9", - "serde", -] - [[package]] name = "bumpalo" version = "3.16.0" @@ -1428,18 +1274,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "calloop-wayland-source" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20" -dependencies = [ - "calloop", - "rustix", - "wayland-backend", - "wayland-client", -] - [[package]] name = "cc" version = "1.2.1" @@ -1495,15 +1329,6 @@ dependencies = [ "libloading 0.8.5", ] -[[package]] -name = "clipboard-win" -version = "5.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15efe7a882b08f34e38556b14f2fb3daa98769d06c7f0c1b076dfd0d983bc892" -dependencies = [ - "error-code", -] - [[package]] name = "codespan-reporting" version = "0.11.1" @@ -1514,12 +1339,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - [[package]] name = "com" version = "0.6.0" @@ -1580,16 +1399,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "console_log" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8aed40e4edbf4d3b4431ab260b63fdc40f5780a4766824329ea0f1eefe3c0f" -dependencies = [ - "log", - "web-sys", -] - [[package]] name = "const-fnv1a-hash" version = "1.1.0" @@ -1633,16 +1442,6 @@ dependencies = [ "libc", ] -[[package]] -name = "core-foundation" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -1656,7 +1455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.4", + "core-foundation", "core-graphics-types", "foreign-types", "libc", @@ -1669,7 +1468,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" dependencies = [ "bitflags 1.3.2", - "core-foundation 0.9.4", + "core-foundation", "libc", ] @@ -1798,40 +1597,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "syn 2.0.89", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.89", -] - [[package]] name = "dasp_sample" version = "0.11.0" @@ -1850,17 +1615,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - [[package]] name = "dlib" version = "0.5.2" @@ -1891,64 +1645,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53" -[[package]] -name = "duplicate" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de78e66ac9061e030587b2a2e75cc88f22304913c907b11307bca737141230cb" -dependencies = [ - "heck", - "proc-macro-error", -] - -[[package]] -name = "ecolor" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e6b451ff1143f6de0f33fc7f1b68fecfd2c7de06e104de96c4514de3f5396f8" -dependencies = [ - "bytemuck", - "emath", -] - -[[package]] -name = "egui" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c97e70a2768de630f161bb5392cbd3874fcf72868f14df0e002e82e06cb798" -dependencies = [ - "ahash", - "emath", - "epaint", - "nohash-hasher", -] - -[[package]] -name = "egui_dock" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629a8b0e440d69996795669ceacc0dd839a997843489273600d31d16c9cb3500" -dependencies = [ - "duplicate", - "egui", - "paste", -] - [[package]] name = "either" version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" -[[package]] -name = "emath" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6a21708405ea88f63d8309650b4d77431f4bc28fb9d8e6f77d3963b51249e6" -dependencies = [ - "bytemuck", -] - [[package]] name = "encase" version = "0.8.0" @@ -1957,7 +1659,7 @@ checksum = "5a9299a95fa5671ddf29ecc22b00e121843a65cb9ff24911e394b4ae556baf36" dependencies = [ "const_panic", "encase_derive", - "glam 0.27.0", + "glam", "thiserror", ] @@ -1981,54 +1683,6 @@ dependencies = [ "syn 2.0.89", ] -[[package]] -name = "enum_dispatch" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" -dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.89", -] - -[[package]] -name = "enumset" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a4b049558765cef5f0c1a273c3fc57084d768b44d2f98127aef4cceb17293" -dependencies = [ - "enumset_derive", -] - -[[package]] -name = "enumset_derive" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59c3b24c345d8c314966bdc1832f6c2635bfcce8e7cf363bd115987bba2ee242" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.89", -] - -[[package]] -name = "epaint" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f0dcc0a0771e7500e94cd1cb797bd13c9f23b9409bdc3c824e2cbc562b7fa01" -dependencies = [ - "ab_glyph", - "ahash", - "bytemuck", - "ecolor", - "emath", - "nohash-hasher", - "parking_lot", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -2055,12 +1709,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "error-code" -version = "3.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5d9305ccc6942a704f4335694ecd3de2ea531b114ac2d51f5f843750787a92f" - [[package]] name = "euclid" version = "0.22.11" @@ -2167,15 +1815,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - [[package]] name = "futures-core" version = "0.3.31" @@ -2201,21 +1840,11 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "fuzzy-matcher" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94" -dependencies = [ - "thread_local", -] - [[package]] name = "game" version = "0.1.0" dependencies = [ "bevy", - "bevy_editor_pls", "bevy_rapier2d", "readformat", ] @@ -2262,7 +1891,7 @@ version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "732dadc05170599ddec9a89653f10d7a2af54da9181b3fa6e2bd49907ec8f7e4" dependencies = [ - "core-foundation 0.9.4", + "core-foundation", "inotify", "io-kit-sys", "js-sys", @@ -2295,20 +1924,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e05e7e6723e3455f4818c7b26e855439f7546cf617ef669d1adedb8669e5cb9" dependencies = [ "bytemuck", - "mint", "rand", "serde", ] -[[package]] -name = "glam" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779ae4bf7e8421cf91c0b3b64e7e8b40b862fba4d393f59150042de7c4965a94" -dependencies = [ - "mint", -] - [[package]] name = "glob" version = "0.3.1" @@ -2483,12 +2102,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "hermit-abi" version = "0.4.0" @@ -2502,7 +2115,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd6b038160f086b0a7496edae34169ae22f328793cbe2b627a5a3d8373748ec" dependencies = [ "constgebra", - "glam 0.27.0", + "glam", ] [[package]] @@ -2511,172 +2124,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "icu_collections" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - -[[package]] -name = "icu_normalizer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" - -[[package]] -name = "icu_properties" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" - -[[package]] -name = "icu_provider" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "image" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "num-traits", -] - [[package]] name = "image" version = "0.25.5" @@ -2687,7 +2134,6 @@ dependencies = [ "byteorder-lite", "num-traits", "png", - "tiff", ] [[package]] @@ -2791,12 +2237,6 @@ dependencies = [ "libc", ] -[[package]] -name = "jpeg-decoder" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" - [[package]] name = "js-sys" version = "0.3.72" @@ -2849,12 +2289,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "lexopt" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baff4b617f7df3d896f97fe922b64817f6cd9a756bb81d40f8883f2f66dcb401" - [[package]] name = "libc" version = "0.2.164" @@ -2914,12 +2348,6 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" -[[package]] -name = "litemap" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" - [[package]] name = "litrs" version = "0.4.1" @@ -2985,15 +2413,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "memmap2" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3f7eed9d3848f8b98834af67102b720745c4ec028fcd0aa0239277e7de374f" -dependencies = [ - "libc", -] - [[package]] name = "metal" version = "0.28.0" @@ -3025,12 +2444,6 @@ dependencies = [ "simd-adler32", ] -[[package]] -name = "mint" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff" - [[package]] name = "naga" version = "0.20.0" @@ -3080,7 +2493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26aecdf64b707efd1310e3544d709c5c0ac61c13756046aaaba41be5c4f66a3b" dependencies = [ "approx", - "glam 0.27.0", + "glam", "matrixmultiply", "nalgebra-macros", "num-complex", @@ -3166,12 +2579,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - [[package]] name = "nom" version = "7.1.3" @@ -3188,15 +2595,6 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "610a5acd306ec67f907abe5567859a3c693fb9886eb1f012ab8f2a47bef3db51" -[[package]] -name = "normpath" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "ntapi" version = "0.4.1" @@ -3547,17 +2945,6 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" -[[package]] -name = "opener" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788" -dependencies = [ - "bstr", - "normpath", - "winapi", -] - [[package]] name = "orbclient" version = "0.3.48" @@ -3754,12 +3141,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa" -[[package]] -name = "pretty-type-name" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f73cdaf19b52e6143685c3606206e114a4dfa969d6b14ec3894c88eb38bd4b" - [[package]] name = "proc-macro-crate" version = "3.2.0" @@ -3769,30 +3150,6 @@ dependencies = [ "toml_edit", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.92" @@ -3808,15 +3165,6 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" -[[package]] -name = "quick-xml" -version = "0.36.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" -dependencies = [ - "memchr", -] - [[package]] name = "quote" version = "1.0.37" @@ -4077,31 +3425,12 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sctk-adwaita" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec" -dependencies = [ - "ab_glyph", - "log", - "memmap2", - "smithay-client-toolkit", - "tiny-skia", -] - [[package]] name = "send_wrapper" version = "0.6.0" @@ -4198,31 +3527,6 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" -[[package]] -name = "smithay-client-toolkit" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016" -dependencies = [ - "bitflags 2.6.0", - "calloop", - "calloop-wayland-source", - "cursor-icon", - "libc", - "log", - "memmap2", - "rustix", - "thiserror", - "wayland-backend", - "wayland-client", - "wayland-csd-frame", - "wayland-cursor", - "wayland-protocols", - "wayland-protocols-wlr", - "wayland-scanner", - "xkeysym", -] - [[package]] name = "smol_str" version = "0.2.2" @@ -4253,24 +3557,12 @@ dependencies = [ "bitflags 2.6.0", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strict-num" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" - [[package]] name = "svg_fmt" version = "0.4.4" @@ -4299,17 +3591,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] - [[package]] name = "sysinfo" version = "0.30.13" @@ -4376,52 +3657,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tiff" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1310fcea54c6a9a4fd1aad794ecc02c31682f6bfbecdf460bf19533eed1e3e" -dependencies = [ - "flate2", - "jpeg-decoder", - "weezl", -] - -[[package]] -name = "tiny-skia" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" -dependencies = [ - "arrayref", - "arrayvec", - "bytemuck", - "cfg-if", - "log", - "tiny-skia-path", -] - -[[package]] -name = "tiny-skia-path" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" -dependencies = [ - "arrayref", - "bytemuck", - "strict-num", -] - -[[package]] -name = "tinystr" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" -dependencies = [ - "displaydoc", - "zerovec", -] - [[package]] name = "tinyvec" version = "1.8.0" @@ -4526,47 +3761,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "transform-gizmo" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b43a029251c55e00d44930e24b78f5b471b3e75fa9c88c30ecb816db08646b93" -dependencies = [ - "ahash", - "ecolor", - "emath", - "enum_dispatch", - "enumset", - "epaint", - "glam 0.28.0", - "mint", -] - -[[package]] -name = "transform-gizmo-bevy" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e8240adbd84abd8b020fe5a5c8eb4f11771495f189cb080eb0344947ac18449" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_core_pipeline", - "bevy_ecs", - "bevy_input", - "bevy_log", - "bevy_math", - "bevy_pbr", - "bevy_reflect", - "bevy_render", - "bevy_transform", - "bevy_utils", - "bevy_window", - "bytemuck", - "transform-gizmo", - "uuid", -] - [[package]] name = "ttf-parser" version = "0.25.0" @@ -4619,29 +3813,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "url" -version = "2.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "uuid" version = "1.11.0" @@ -4753,115 +3924,6 @@ version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" -[[package]] -name = "wayland-backend" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "056535ced7a150d45159d3a8dc30f91a2e2d588ca0b23f70e56033622b8016f6" -dependencies = [ - "cc", - "downcast-rs", - "rustix", - "scoped-tls", - "smallvec", - "wayland-sys", -] - -[[package]] -name = "wayland-client" -version = "0.31.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280" -dependencies = [ - "bitflags 2.6.0", - "rustix", - "wayland-backend", - "wayland-scanner", -] - -[[package]] -name = "wayland-csd-frame" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e" -dependencies = [ - "bitflags 2.6.0", - "cursor-icon", - "wayland-backend", -] - -[[package]] -name = "wayland-cursor" -version = "0.31.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b08bc3aafdb0035e7fe0fdf17ba0c09c268732707dca4ae098f60cb28c9e4c" -dependencies = [ - "rustix", - "wayland-client", - "xcursor", -] - -[[package]] -name = "wayland-protocols" -version = "0.32.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd0ade57c4e6e9a8952741325c30bf82f4246885dca8bf561898b86d0c1f58e" -dependencies = [ - "bitflags 2.6.0", - "wayland-backend", - "wayland-client", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-plasma" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b31cab548ee68c7eb155517f2212049dc151f7cd7910c2b66abfd31c3ee12bd" -dependencies = [ - "bitflags 2.6.0", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-protocols-wlr" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "782e12f6cd923c3c316130d56205ebab53f55d6666b7faddfad36cecaeeb4022" -dependencies = [ - "bitflags 2.6.0", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-scanner", -] - -[[package]] -name = "wayland-scanner" -version = "0.31.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597f2001b2e5fc1121e3d5b9791d3e78f05ba6bfa4641053846248e3a13661c3" -dependencies = [ - "proc-macro2", - "quick-xml", - "quote", -] - -[[package]] -name = "wayland-sys" -version = "0.31.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efa8ac0d8e8ed3e3b5c9fc92c7881406a268e11555abe36493efabe649a29e09" -dependencies = [ - "dlib", - "log", - "once_cell", - "pkg-config", -] - [[package]] name = "web-sys" version = "0.3.72" @@ -4882,30 +3944,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webbrowser" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5f07fb9bc8de2ddfe6b24a71a75430673fd679e568c48b52716cef1cfae923" -dependencies = [ - "block2", - "core-foundation 0.10.0", - "home", - "jni", - "log", - "ndk-context", - "objc2", - "objc2-foundation", - "url", - "web-sys", -] - -[[package]] -name = "weezl" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" - [[package]] name = "wgpu" version = "0.20.1" @@ -5207,15 +4245,6 @@ dependencies = [ "windows-targets 0.42.2", ] -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-sys" version = "0.52.0" @@ -5418,7 +4447,6 @@ version = "0.30.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0be9e76a1f1077e04a411f0b989cbd3c93339e1771cb41e71ac4aee95bfd2c67" dependencies = [ - "ahash", "android-activity", "atomic-waker", "bitflags 2.6.0", @@ -5427,13 +4455,12 @@ dependencies = [ "calloop", "cfg_aliases 0.2.1", "concurrent-queue", - "core-foundation 0.9.4", + "core-foundation", "core-graphics", "cursor-icon", "dpi", "js-sys", "libc", - "memmap2", "ndk 0.9.0", "objc2", "objc2-app-kit", @@ -5445,17 +4472,11 @@ dependencies = [ "raw-window-handle", "redox_syscall 0.4.1", "rustix", - "sctk-adwaita", - "smithay-client-toolkit", "smol_str", "tracing", "unicode-segmentation", "wasm-bindgen", "wasm-bindgen-futures", - "wayland-backend", - "wayland-client", - "wayland-protocols", - "wayland-protocols-plasma", "web-sys", "web-time", "windows-sys 0.52.0", @@ -5473,18 +4494,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" - [[package]] name = "x11-dl" version = "2.21.0" @@ -5517,12 +4526,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d" -[[package]] -name = "xcursor" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef33da6b1660b4ddbfb3aef0ade110c8b8a781a3b6382fa5f2b5b040fd55f61" - [[package]] name = "xi-unicode" version = "0.3.0" @@ -5554,30 +4557,6 @@ version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af310deaae937e48a26602b730250b4949e125f468f11e6990be3e5304ddd96f" -[[package]] -name = "yoke" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", - "synstructure", -] - [[package]] name = "zerocopy" version = "0.7.35" @@ -5597,46 +4576,3 @@ dependencies = [ "quote", "syn 2.0.89", ] - -[[package]] -name = "zerofrom" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", - "synstructure", -] - -[[package]] -name = "zerovec" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.89", -] diff --git a/Cargo.toml b/Cargo.toml index 5c7b2fd..5d34dac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] bevy = { version = "0.14.2" } bevy_rapier2d = {version = "0.27.0", features = ["debug-render-2d", "simd-stable", "parallel"]} -bevy_editor_pls = "0.10" +# bevy_editor_pls = "0.10" readformat = "0.1.2" # Enable a small amount of optimization in the dev profile. diff --git a/src/game.rs b/src/game.rs index 0db1335..d10f64c 100644 --- a/src/game.rs +++ b/src/game.rs @@ -7,7 +7,7 @@ use crate::AppState; mod player; mod scene; -mod set; +pub mod set; pub const WORLD_DEPTH: f32 = 0.5; pub const PLAYER_DEPTH: f32 = 0.4; diff --git a/src/game/player.rs b/src/game/player.rs index 3f98c33..4552bb1 100644 --- a/src/game/player.rs +++ b/src/game/player.rs @@ -59,7 +59,8 @@ pub(super) fn player_plugin(app: &mut App) { move_player, debug_player_pos, run_animations::, - ), + ) + .in_set(IngameSet), ) .init_resource::(); } diff --git a/src/game/scene.rs b/src/game/scene.rs index 10383b5..22629c6 100644 --- a/src/game/scene.rs +++ b/src/game/scene.rs @@ -13,6 +13,7 @@ use crate::parallax::{parallax, Parallax}; use crate::AppState; use super::player::PlayerSpawnOneshot; +use super::set::IngameSet; use super::{PLAYER_DEPTH, PLAYER_SIZE_FRACTION}; #[derive(Component)] @@ -52,7 +53,7 @@ impl From for Transform { pub(super) fn scene_plugin(app: &mut App) { // app.add_plugins(EditorPlugin::default()); // app.add_systems(, ) - app.add_systems(Startup, (import_text_world,)); + app.add_systems(Startup, (import_text_world,).in_set(IngameSet)); } #[derive(Default, Resource)] diff --git a/src/main.rs b/src/main.rs index 874ec2e..a071c63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,8 @@ #![allow(unused)] + use bevy::prelude::*; use bevy_rapier2d::prelude::*; -use game::game_plugin; +use game::{game_plugin, set::IngameSet}; use parallax::parallax_plugin; mod game; @@ -13,6 +14,7 @@ const METER: f32 = 100.; enum AppState { #[default] MainMenu, + StoryPics, InGame, GameOver, } @@ -24,6 +26,15 @@ enum PausedState { Running, } +#[derive(States, Debug, Clone, PartialEq, Eq, Hash, Default)] +enum StoryPics { + #[default] + Pic0, + Pic1, + Pic2, + Pic3, +} + fn main() { let rapier_config = RapierConfiguration { scaled_shape_subdivision: 2, @@ -46,11 +57,110 @@ fn main() { .add_plugins(parallax_plugin) .init_state::() .init_state::() - .insert_state(AppState::InGame) // TODO dont + .insert_state(AppState::StoryPics) // TODO dont + .init_state::() .insert_resource(rapier_config) + .configure_sets(Update, IngameSet.run_if(in_state(AppState::InGame))) + .add_systems(OnEnter(AppState::StoryPics), setup_storypics) + .add_systems( + Update, + (storypic_next_thingy, update_storypics).run_if(in_state(AppState::StoryPics)), + ) + .add_systems(OnExit(AppState::StoryPics), cleanup_storypics) .run(); } fn setup_camera(mut commands: Commands) { commands.spawn(Camera2dBundle::default()); } + +#[derive(Component)] +struct StoryPicMarker; +#[derive(Component)] +struct StoryPicNextBtnMarker; + +fn setup_storypics(mut commands: Commands, asset_server: Res) { + let pic0 = asset_server.load("SC01_Once upon a time.png"); + // force preloads + let _pic1: Handle = asset_server.load("SC02_Gargels_Tower.png"); + let _pic2: Handle = asset_server.load("SC03_The Egg.png"); + let _pic3: Handle = asset_server.load("SC04_The Letter.png"); + commands + .spawn(ImageBundle { + image: UiImage { + texture: pic0, + ..Default::default() + }, + style: Style { + width: Val::Percent(100.), + height: Val::Percent(100.), + + justify_content: JustifyContent::End, + align_items: AlignItems::End, + ..Default::default() + }, + ..Default::default() + }) + .insert(StoryPicMarker) + .with_children(|parent| { + parent + .spawn((ButtonBundle { + ..Default::default() + },)) + .insert(StoryPicNextBtnMarker) + .with_children(|parent| { + parent.spawn(TextBundle::from_section( + "Weiter...", + TextStyle { + font_size: 64., + ..Default::default() + }, + )); + }); + }); +} + +fn storypic_next_thingy( + interaction_query: Query<&Interaction, (Changed, With)>, + cur_pic: Res>, + mut pic_switcher: ResMut>, + mut game_state: ResMut>, +) { + let Ok(interaction) = interaction_query.get_single() else { + return (); + }; + if *interaction == Interaction::Pressed && *cur_pic == StoryPics::Pic3 { + game_state.set(AppState::InGame); + } else if *interaction == Interaction::Pressed { + pic_switcher.set(match cur_pic.clone() { + StoryPics::Pic0 => StoryPics::Pic1, + StoryPics::Pic1 => StoryPics::Pic2, + StoryPics::Pic2 => StoryPics::Pic3, + StoryPics::Pic3 => unreachable!(), + }); + } +} + +fn update_storypics( + mut commands: Commands, + mut cur_pic: Query<&mut UiImage, With>, + cur_pic_state: Res>, + asset_server: Res, +) { + if cur_pic_state.is_changed() { + let mut pic = cur_pic.single_mut(); + + pic.texture = asset_server.load(match cur_pic_state.clone() { + StoryPics::Pic0 => "SC01_Once upon a time.png", + StoryPics::Pic1 => "SC02_Gargels_Tower.png", + StoryPics::Pic2 => "SC03_The Egg.png", + StoryPics::Pic3 => "SC04_The Letter.png", + }) + } +} + +fn cleanup_storypics(mut commands: Commands, to_delete: Query>) { + for e in &to_delete { + commands.entity(e).despawn_recursive(); + } +}