diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 384550c..f8e5e87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,7 @@ name: CI on: pull_request: + branches: [main] push: branches: [main] @@ -27,14 +28,6 @@ jobs: run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev if: runner.os == 'linux' - - name: Check the format - run: cargo run --all --check - if: runner.os == 'linux' - - - name: Run clippy - run: cargo clippy --workspace --all-targets --all-features - if: runner.os == 'linux' - - name: Build & run tests run: cargo test --workspace env: diff --git a/Cargo.lock b/Cargo.lock index 9f7272f..3668e74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -24,12 +24,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9fe5e32de01730eb1f6b7f5b51c17e03e2325bf40a74f754f04f130043affff" -[[package]] -name = "adler32" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" - [[package]] name = "ahash" version = "0.4.7" @@ -42,7 +36,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f200cbb1e856866d9eade941cf3aa0c5d7dd36f74311c4273b494f4ef036957" dependencies = [ - "getrandom 0.2.3", + "getrandom", "once_cell", "version_check", ] @@ -56,28 +50,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "alsa" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75c4da790adcb2ce5e758c064b4f3ec17a30349f9961d3e5e6c9688b052a9e18" -dependencies = [ - "alsa-sys", - "bitflags", - "libc", - "nix", -] - -[[package]] -name = "alsa-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" -dependencies = [ - "libc", - "pkg-config", -] - [[package]] name = "android_log-sys" version = "0.1.2" @@ -198,12 +170,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "base-x" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" - [[package]] name = "base64" version = "0.13.0" @@ -263,13 +229,13 @@ dependencies = [ "bevy_reflect", "bevy_tasks", "bevy_utils 0.5.0 (git+https://github.com/bevyengine/bevy?branch=main)", - "crossbeam-channel 0.5.1", + "crossbeam-channel", "downcast-rs", "js-sys", "ndk-glue 0.2.1", "notify", "parking_lot", - "rand 0.8.3", + "rand", "ron", "serde", "thiserror", @@ -278,21 +244,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "bevy_audio" -version = "0.5.0" -source = "git+https://github.com/bevyengine/bevy?branch=main#653c10371e546176059bb779844c0569c0190b6b" -dependencies = [ - "anyhow", - "bevy_app", - "bevy_asset", - "bevy_ecs", - "bevy_reflect", - "bevy_utils 0.5.0 (git+https://github.com/bevyengine/bevy?branch=main)", - "parking_lot", - "rodio", -] - [[package]] name = "bevy_core" version = "0.5.0" @@ -333,15 +284,6 @@ dependencies = [ "parking_lot", ] -[[package]] -name = "bevy_dynamic_plugin" -version = "0.5.0" -source = "git+https://github.com/bevyengine/bevy?branch=main#653c10371e546176059bb779844c0569c0190b6b" -dependencies = [ - "bevy_app", - "libloading", -] - [[package]] name = "bevy_ecs" version = "0.5.0" @@ -357,7 +299,7 @@ dependencies = [ "fixedbitset 0.4.0", "fxhash", "parking_lot", - "rand 0.8.3", + "rand", "serde", "thiserror", ] @@ -373,41 +315,6 @@ dependencies = [ "syn", ] -[[package]] -name = "bevy_gilrs" -version = "0.5.0" -source = "git+https://github.com/bevyengine/bevy?branch=main#653c10371e546176059bb779844c0569c0190b6b" -dependencies = [ - "bevy_app", - "bevy_ecs", - "bevy_input", - "bevy_utils 0.5.0 (git+https://github.com/bevyengine/bevy?branch=main)", - "gilrs", -] - -[[package]] -name = "bevy_gltf" -version = "0.5.0" -source = "git+https://github.com/bevyengine/bevy?branch=main#653c10371e546176059bb779844c0569c0190b6b" -dependencies = [ - "anyhow", - "base64", - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_ecs", - "bevy_log 0.5.0 (git+https://github.com/bevyengine/bevy?branch=main)", - "bevy_math", - "bevy_pbr", - "bevy_reflect", - "bevy_render", - "bevy_scene", - "bevy_transform", - "gltf", - "percent-encoding", - "thiserror", -] - [[package]] name = "bevy_input" version = "0.5.0" @@ -417,7 +324,6 @@ dependencies = [ "bevy_ecs", "bevy_math", "bevy_utils 0.5.0 (git+https://github.com/bevyengine/bevy?branch=main)", - "serde", ] [[package]] @@ -427,14 +333,10 @@ source = "git+https://github.com/bevyengine/bevy?branch=main#653c10371e546176059 dependencies = [ "bevy_app", "bevy_asset", - "bevy_audio", "bevy_core", "bevy_derive", "bevy_diagnostic", - "bevy_dynamic_plugin", "bevy_ecs", - "bevy_gilrs", - "bevy_gltf", "bevy_input", "bevy_log 0.5.0 (git+https://github.com/bevyengine/bevy?branch=main)", "bevy_math", @@ -700,7 +602,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c384a69b670329f968f59abdcf6506f183cf18b8619d6ec1cbfe33e268e5da20" dependencies = [ "ahash 0.7.2", - "getrandom 0.2.3", + "getrandom", "instant", "tracing", "uuid", @@ -713,7 +615,7 @@ source = "git+https://github.com/bevyengine/bevy?branch=main#653c10371e546176059 dependencies = [ "ahash 0.7.2", "bevy_derive", - "getrandom 0.2.3", + "getrandom", "instant", "tracing", "uuid", @@ -733,8 +635,8 @@ dependencies = [ "bevy_utils 0.5.0 (git+https://github.com/bevyengine/bevy?branch=main)", "bevy_window", "bevy_winit", - "crossbeam-channel 0.5.1", - "crossbeam-utils 0.8.4", + "crossbeam-channel", + "crossbeam-utils", "futures-lite", "parking_lot", "wgpu", @@ -769,25 +671,6 @@ dependencies = [ "winit", ] -[[package]] -name = "bindgen" -version = "0.56.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex 0.1.1", -] - [[package]] name = "bindgen" version = "0.58.1" @@ -807,7 +690,7 @@ dependencies = [ "quote", "regex", "rustc-hash", - "shlex 1.0.0", + "shlex", "which", ] @@ -882,12 +765,6 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" -[[package]] -name = "bytes" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" - [[package]] name = "cache-padded" version = "1.1.1" @@ -911,7 +788,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57cdfa5d50aad6cb4d44dcab6101a7f79925bd59d82ca42f38a9856a28865374" dependencies = [ - "rustc_version 0.3.3", + "rustc_version", ] [[package]] @@ -923,12 +800,6 @@ dependencies = [ "jobserver", ] -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - [[package]] name = "cexpr" version = "0.4.0" @@ -1050,16 +921,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" -[[package]] -name = "combine" -version = "4.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4369b5e4c0cddf64ad8981c0111e7df4f7078f4d6ba98fb31f2e17c4c57b7e" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "concurrent-queue" version = "1.2.2" @@ -1085,16 +946,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" -[[package]] -name = "core-foundation" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" -dependencies = [ - "core-foundation-sys 0.6.2", - "libc", -] - [[package]] name = "core-foundation" version = "0.7.0" @@ -1115,12 +966,6 @@ dependencies = [ "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.7.0" @@ -1183,59 +1028,6 @@ dependencies = [ "objc", ] -[[package]] -name = "coreaudio-rs" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11894b20ebfe1ff903cbdc52259693389eea03b94918a2def2c30c3bf227ad88" -dependencies = [ - "bitflags", - "coreaudio-sys", -] - -[[package]] -name = "coreaudio-sys" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b7e3347be6a09b46aba228d6608386739fb70beff4f61e07422da87b0bb31fa" -dependencies = [ - "bindgen 0.56.0", -] - -[[package]] -name = "cpal" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8351ddf2aaa3c583fa388029f8b3d26f3c7035a20911fdd5f2e2ed7ab57dad25" -dependencies = [ - "alsa", - "core-foundation-sys 0.6.2", - "coreaudio-rs", - "jni", - "js-sys", - "lazy_static", - "libc", - "mach 0.3.2", - "ndk 0.3.0", - "ndk-glue 0.3.0", - "nix", - "oboe", - "parking_lot", - "stdweb 0.1.3", - "thiserror", - "web-sys", - "winapi", -] - -[[package]] -name = "crc32fast" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "criterion" version = "0.3.4" @@ -1272,30 +1064,6 @@ dependencies = [ "itertools 0.9.0", ] -[[package]] -name = "crossbeam" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-channel 0.4.4", - "crossbeam-deque 0.7.3", - "crossbeam-epoch 0.8.2", - "crossbeam-queue", - "crossbeam-utils 0.7.2", -] - -[[package]] -name = "crossbeam-channel" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" -dependencies = [ - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - [[package]] name = "crossbeam-channel" version = "0.5.1" @@ -1303,18 +1071,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.4", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285" -dependencies = [ - "crossbeam-epoch 0.8.2", - "crossbeam-utils 0.7.2", - "maybe-uninit", + "crossbeam-utils", ] [[package]] @@ -1324,23 +1081,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ "cfg-if 1.0.0", - "crossbeam-epoch 0.9.4", - "crossbeam-utils 0.8.4", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "lazy_static", - "maybe-uninit", - "memoffset 0.5.6", - "scopeguard", + "crossbeam-epoch", + "crossbeam-utils", ] [[package]] @@ -1350,34 +1092,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52fb27eab85b17fbb9f6fd667089e07d6a2eb8743d02639ee7f6a7a7729c9c94" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.4", + "crossbeam-utils", "lazy_static", - "memoffset 0.6.3", + "memoffset", "scopeguard", ] -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", -] - [[package]] name = "crossbeam-utils" version = "0.8.4" @@ -1457,16 +1177,6 @@ dependencies = [ "syn", ] -[[package]] -name = "deflate" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" -dependencies = [ - "adler32", - "byteorder", -] - [[package]] name = "derivative" version = "2.2.0" @@ -1478,12 +1188,6 @@ dependencies = [ "syn", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "dispatch" version = "0.2.0" @@ -1550,45 +1254,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7531096570974c3a9dcf9e4b8e1cede1ec26cf5046219fb3b9d897503b9be59" [[package]] -name = "fastrand" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77b705829d1e87f762c2df6da140b26af5839e1033aa84aa5f56bb688e4e1bdb" -dependencies = [ - "instant", -] - -[[package]] -name = "fc" +name = "fantasy-crescendo" version = "0.1.0" dependencies = [ "anyhow", "bevy", "bevy-steamworks", "bitflags", - "fc-core", - "libm 0.2.1", - "serde", - "serde_json", -] - -[[package]] -name = "fc-core" -version = "0.1.0" -dependencies = [ - "bevy", - "bevy_input", - "bitflags", "criterion", "glam", + "libm 0.2.1", "serde", + "serde_json", ] [[package]] -name = "fc-editor" -version = "0.1.0" +name = "fastrand" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77b705829d1e87f762c2df6da140b26af5839e1033aa84aa5f56bb688e4e1bdb" dependencies = [ - "bevy", + "instant", ] [[package]] @@ -1691,17 +1377,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.3" @@ -1711,7 +1386,7 @@ dependencies = [ "cfg-if 1.0.0", "js-sys", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] @@ -1862,46 +1537,14 @@ dependencies = [ ] [[package]] -name = "gilrs" -version = "0.8.1" +name = "glam" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e986f911d937f4395dfc2a39618dcef452773d32dcdbe0828c623f76588f749" +checksum = "3abb554f8ee44336b72d522e0a7fe86a29e09f839a36022fa869a7dfe941a54b" dependencies = [ - "fnv", - "gilrs-core", - "log", - "uuid", - "vec_map", -] - -[[package]] -name = "gilrs-core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5e5bb97bf9a0d9519a28cf38839cf1d6d9bb572b48e3c67202271fec2ed5e7" -dependencies = [ - "core-foundation 0.6.4", - "io-kit-sys", - "libc", - "libudev-sys", - "log", - "nix", - "rusty-xinput", - "stdweb 0.4.20", - "uuid", - "vec_map", - "winapi", -] - -[[package]] -name = "glam" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3abb554f8ee44336b72d522e0a7fe86a29e09f839a36022fa869a7dfe941a54b" -dependencies = [ - "bytemuck", - "num-traits", - "serde", + "bytemuck", + "num-traits", + "serde", ] [[package]] @@ -1922,41 +1565,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "gltf" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff38b75359a0096dd0a8599b6e4f37a6ee41d5df300cc7669e62aafa697f7a2" -dependencies = [ - "byteorder", - "gltf-json", - "lazy_static", -] - -[[package]] -name = "gltf-derive" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f2a9333e0f9c7bca94dfc20bcf44fa12a61eeec662d6e007563ff748aa59c70" -dependencies = [ - "inflections", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "gltf-json" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1414d3a98cbaabdb2f134328b1f6036d14b282febc1df51952a435d2ca17fb6" -dependencies = [ - "gltf-derive", - "serde", - "serde_derive", - "serde_json", -] - [[package]] name = "glyph_brush_layout" version = "0.2.1" @@ -2081,8 +1689,6 @@ dependencies = [ "num-iter", "num-rational", "num-traits", - "png", - "scoped_threadpool", ] [[package]] @@ -2095,12 +1701,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "inflections" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" - [[package]] name = "inotify" version = "0.9.3" @@ -2139,16 +1739,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "io-kit-sys" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f21dcc74995dd4cd090b147e79789f8d65959cbfb5f0b118002db869ea3bd0a0" -dependencies = [ - "core-foundation-sys 0.6.2", - "mach 0.2.3", -] - [[package]] name = "itertools" version = "0.9.0" @@ -2173,20 +1763,6 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -[[package]] -name = "jni" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24967112a1e4301ca5342ea339763613a37592b8a6ce6cf2e4494537c7a42faf" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", -] - [[package]] name = "jni-sys" version = "0.3.0" @@ -2261,16 +1837,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" -[[package]] -name = "libudev-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" -dependencies = [ - "libc", - "pkg-config", -] - [[package]] name = "lock_api" version = "0.4.4" @@ -2289,24 +1855,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "mach" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" -dependencies = [ - "libc", -] - -[[package]] -name = "mach" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" -dependencies = [ - "libc", -] - [[package]] name = "malloc_buf" version = "0.0.6" @@ -2325,27 +1873,12 @@ dependencies = [ "regex-automata", ] -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "memchr" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" -[[package]] -name = "memoffset" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.6.3" @@ -2369,35 +1902,6 @@ dependencies = [ "objc", ] -[[package]] -name = "minimp3" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "985438f75febf74c392071a975a29641b420dd84431135a6e6db721de4b74372" -dependencies = [ - "minimp3-sys", - "slice-deque", - "thiserror", -] - -[[package]] -name = "minimp3-sys" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e21c73734c69dc95696c9ed8926a2b393171d98b3f5f5935686a26a487ab9b90" -dependencies = [ - "cc", -] - -[[package]] -name = "miniz_oxide" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" -dependencies = [ - "adler32", -] - [[package]] name = "mio" version = "0.7.11" @@ -2411,19 +1915,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "mio-misc" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0826571dd48cc55b6310c06daad1a037ccec60c6eb056be7844995140482690" -dependencies = [ - "crossbeam", - "crossbeam-queue", - "log", - "mio", - "rand 0.7.3", -] - [[package]] name = "miow" version = "0.3.7" @@ -2522,18 +2013,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" -[[package]] -name = "nix" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" -dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.0", - "libc", -] - [[package]] name = "nom" version = "5.1.2" @@ -2551,7 +2030,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46bbbcd078f1f00ddb7a9abe70b96e91229b44b0b3afdec610f8e5137f8f014b" dependencies = [ "bitflags", - "crossbeam-channel 0.5.1", + "crossbeam-channel", "filetime", "fsevent", "fsevent-sys", @@ -2571,17 +2050,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "num-integer" version = "0.1.44" @@ -2697,29 +2165,6 @@ dependencies = [ "cc", ] -[[package]] -name = "oboe" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cfb2390bddb9546c0f7448fd1d2abdd39e6075206f960991eb28c7fa7f126c4" -dependencies = [ - "jni", - "ndk 0.3.0", - "ndk-glue 0.3.0", - "num-derive", - "num-traits", - "oboe-sys", -] - -[[package]] -name = "oboe-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe069264d082fc820dfa172f79be3f2e088ecfece9b1c47b0c9fd838d2bef103" -dependencies = [ - "cc", -] - [[package]] name = "once_cell" version = "1.7.2" @@ -2778,12 +2223,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - [[package]] name = "pest" version = "2.1.3" @@ -2809,12 +2248,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" -[[package]] -name = "pkg-config" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" - [[package]] name = "plotters" version = "0.3.0" @@ -2843,18 +2276,6 @@ dependencies = [ "plotters-backend", ] -[[package]] -name = "png" -version = "0.16.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" -dependencies = [ - "bitflags", - "crc32fast", - "deflate", - "miniz_oxide", -] - [[package]] name = "ppv-lite86" version = "0.2.10" @@ -2894,19 +2315,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc 0.2.0", -] - [[package]] name = "rand" version = "0.8.3" @@ -2914,19 +2322,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", - "rand_chacha 0.3.0", - "rand_core 0.6.2", - "rand_hc 0.3.0", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", + "rand_hc", ] [[package]] @@ -2936,16 +2334,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" dependencies = [ "ppv-lite86", - "rand_core 0.6.2", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -2954,16 +2343,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" dependencies = [ - "getrandom 0.2.3", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -2972,7 +2352,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" dependencies = [ - "rand_core 0.6.2", + "rand_core", ] [[package]] @@ -2997,7 +2377,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" dependencies = [ "autocfg", - "crossbeam-deque 0.8.0", + "crossbeam-deque", "either", "rayon-core", ] @@ -3008,9 +2388,9 @@ version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" dependencies = [ - "crossbeam-channel 0.5.1", - "crossbeam-deque 0.8.0", - "crossbeam-utils 0.8.4", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", "lazy_static", "num_cpus", ] @@ -3057,16 +2437,6 @@ version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" -[[package]] -name = "rodio" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65c2eda643191f6d1bb12ea323a9db8d9ba95374e9be3780b5a9fb5cfb8520f" -dependencies = [ - "cpal", - "minimp3", -] - [[package]] name = "ron" version = "0.6.4" @@ -3084,33 +2454,13 @@ 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 0.9.0", -] - [[package]] name = "rustc_version" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" dependencies = [ - "semver 0.11.0", -] - -[[package]] -name = "rusty-xinput" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2aa654bc32eb9ca14cce1a084abc9dfe43949a4547c35269a094c39272db3bb" -dependencies = [ - "lazy_static", - "log", - "winapi", + "semver", ] [[package]] @@ -3128,42 +2478,21 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scoped_threadpool" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" - [[package]] name = "scopeguard" 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 0.7.0", -] - [[package]] name = "semver" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" dependencies = [ - "semver-parser 0.10.2", + "semver-parser", ] -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "semver-parser" version = "0.10.2" @@ -3214,12 +2543,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - [[package]] name = "shaderc" version = "0.7.2" @@ -3249,12 +2572,6 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "shlex" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" - [[package]] name = "shlex" version = "1.0.0" @@ -3267,17 +2584,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" -[[package]] -name = "slice-deque" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31ef6ee280cdefba6d2d0b4b78a84a1c1a3f3a4cec98c2d4231c8bc225de0f25" -dependencies = [ - "libc", - "mach 0.3.2", - "winapi", -] - [[package]] name = "slotmap" version = "0.4.0" @@ -3328,63 +2634,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "stdweb" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" - -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version 0.2.3", - "serde", - "serde_json", - "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 = "steamworks" version = "0.7.0" @@ -3401,7 +2650,7 @@ name = "steamworks-sys" version = "0.7.0" source = "git+https://github.com/james7132/steamworks-rs?branch=cargo-run-fix#dd4fef7b6e88451f8716057b9789877ce26363fb" dependencies = [ - "bindgen 0.58.1", + "bindgen", ] [[package]] @@ -3641,7 +2890,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "getrandom 0.2.3", + "getrandom", "serde", ] @@ -3674,12 +2923,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" @@ -3877,20 +3120,16 @@ dependencies = [ "lazy_static", "libc", "log", - "mio", - "mio-misc", "ndk 0.3.0", "ndk-glue 0.3.0", "ndk-sys", "objc", "parking_lot", - "percent-encoding", "raw-window-handle", "scopeguard", "wasm-bindgen", "web-sys", "winapi", - "x11-dl", ] [[package]] @@ -3902,18 +3141,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "x11-dl" -version = "2.18.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf981e3a5b3301209754218f962052d4d9ee97e478f4d26d4a6eced34c1fef8" -dependencies = [ - "lazy_static", - "libc", - "maybe-uninit", - "pkg-config", -] - [[package]] name = "xi-unicode" version = "0.3.0" diff --git a/Cargo.toml b/Cargo.toml index 8389d79..dc3e2e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,15 +1,47 @@ -[workspace] -members = [ - "core", - "editor", - "game" -] +[package] +name = "fantasy-crescendo" +version = "0.1.0" +authors = ["james7132 "] +edition = "2018" +default-run = "fc" + +[[bin]] +name = "fc" +path = "src/game.rs" + +[[bin]] +name = "fc-editor" +path = "src/editor.rs" [profile.release] lto = true opt-level = 3 panic = "abort" +[features] +default = [] +steam-restart = [] + +[dependencies] +bitflags = "1.2" +serde = "1.0" +bevy-steamworks = "0.1" +anyhow = "1.0" +serde_json = "1.0" +libm = "0.2" + +[dependencies.bevy] +version = "0.5" +default-features = false +features = ["bevy_winit", "render", "bevy_wgpu"] + +[dependencies.glam] +version = "0.15" +features = ["libm"] + +[dev-dependencies] +criterion = "0.3" + [patch.crates-io] bevy = { git = "https://github.com/bevyengine/bevy", branch = "main" } bevy_app = { git = "https://github.com/bevyengine/bevy", branch = "main" } @@ -18,4 +50,8 @@ bevy_input = { git = "https://github.com/bevyengine/bevy", branch = "main" } bevy_math = { git = "https://github.com/bevyengine/bevy", branch = "main" } bevy_reflect = { git = "https://github.com/bevyengine/bevy", branch = "main" } steamworks = { git = "https://github.com/james7132/steamworks-rs", branch = "cargo-run-fix" } -steamworks-sys = { git = "https://github.com/james7132/steamworks-rs", branch = "cargo-run-fix" } \ No newline at end of file +steamworks-sys = { git = "https://github.com/james7132/steamworks-rs", branch = "cargo-run-fix" } + +[[bench]] +name = "capsule" +harness = false \ No newline at end of file diff --git a/game/assets/characters/marisa_kirisame.chr b/assets/characters/marisa_kirisame.chr similarity index 100% rename from game/assets/characters/marisa_kirisame.chr rename to assets/characters/marisa_kirisame.chr diff --git a/game/assets/characters/reimu_hakurei.chr b/assets/characters/reimu_hakurei.chr similarity index 100% rename from game/assets/characters/reimu_hakurei.chr rename to assets/characters/reimu_hakurei.chr diff --git a/game/assets/characters/sakuya_izayoi.chr b/assets/characters/sakuya_izayoi.chr similarity index 100% rename from game/assets/characters/sakuya_izayoi.chr rename to assets/characters/sakuya_izayoi.chr diff --git a/game/assets/fonts/FiraMono-Medium.ttf b/assets/fonts/FiraMono-Medium.ttf similarity index 100% rename from game/assets/fonts/FiraMono-Medium.ttf rename to assets/fonts/FiraMono-Medium.ttf diff --git a/game/assets/fonts/FiraSans-Bold.ttf b/assets/fonts/FiraSans-Bold.ttf similarity index 100% rename from game/assets/fonts/FiraSans-Bold.ttf rename to assets/fonts/FiraSans-Bold.ttf diff --git a/game/assets/stages/forest_of_magic.stage b/assets/stages/forest_of_magic.stage similarity index 100% rename from game/assets/stages/forest_of_magic.stage rename to assets/stages/forest_of_magic.stage diff --git a/core/benches/capsule.rs b/benches/capsule.rs similarity index 97% rename from core/benches/capsule.rs rename to benches/capsule.rs index aff830e..cb035d2 100644 --- a/core/benches/capsule.rs +++ b/benches/capsule.rs @@ -1,5 +1,5 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion}; -use fc_core::geo::Capsule3D; +use fc::geo::Capsule3D; fn criterion_benchmark(c: &mut Criterion) { let sphere_a = Capsule3D::sphere((0.0, 0.0, 0.0), 3.0); diff --git a/core/Cargo.toml b/core/Cargo.toml deleted file mode 100644 index c822816..0000000 --- a/core/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "fc-core" -version = "0.1.0" -authors = ["james7132 "] -edition = "2018" - -[dependencies] -bitflags = "1.2" -serde = "1.0" - -[dependencies.bevy] -version = "0.5" -default-features = false -features = ["render"] - -[dependencies.bevy_input] -version = "0.5" -features = ["serialize"] - -[dependencies.glam] -version = "0.15" -features = ["libm"] - -[dev-dependencies] -criterion = "0.3" - -[[bench]] -name = "capsule" -harness = false \ No newline at end of file diff --git a/core/src/debug/mod.rs b/core/src/debug/mod.rs deleted file mode 100644 index 89d94d9..0000000 --- a/core/src/debug/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -mod capsule; -mod line; - -pub use self::capsule::*; -pub use self::line::*; diff --git a/core/src/lib.rs b/core/src/lib.rs deleted file mode 100644 index 1212137..0000000 --- a/core/src/lib.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[macro_use] -extern crate bitflags; - -pub mod character; -pub mod debug; -pub mod geo; -pub mod input; -pub mod player; -pub mod stage; diff --git a/core/src/player.rs b/core/src/player.rs deleted file mode 100644 index 8894187..0000000 --- a/core/src/player.rs +++ /dev/null @@ -1,39 +0,0 @@ -pub type PlayerId = u8; - -#[derive(Debug, Default, Clone, PartialEq, Eq)] -pub struct Player { - pub id: PlayerId, -} - -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] -pub enum Facing { - Left = 0, - Right = 1, -} - -impl Default for Facing { - fn default() -> Self { - Self::Left - } -} - -impl Facing { - pub fn is_left(&self) -> bool { - *self == Self::Left - } - - pub fn is_right(&self) -> bool { - *self == Self::Left - } - - pub fn invert(&mut self) { - *self = self.inverted() - } - - pub fn inverted(&self) -> Self { - match self { - Self::Left => Self::Right, - Self::Right => Self::Left, - } - } -} diff --git a/core/src/stage.rs b/core/src/stage.rs deleted file mode 100644 index 280e11a..0000000 --- a/core/src/stage.rs +++ /dev/null @@ -1,158 +0,0 @@ -use crate::geo::*; -use crate::player::{Facing, Player}; -use bevy::{math::Vec2, reflect::TypeUuid}; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, TypeUuid)] -#[uuid = "c0176bef-fe0f-4384-ae04-c9efa9a1918c"] -pub struct StageAsset { - pub name: String, -} - -#[derive(Debug, Clone)] -pub struct BlastZone(pub Bounds2D); - -#[derive(Debug, Clone)] -pub struct SpawnPoint { - pub position: Vec2, - pub facing: Facing, -} - -#[derive(Debug, Clone)] -pub struct RespawnPoint { - pub position: Vec2, - pub facing: Facing, - pub occupied_by: Option, -} - -#[derive(Debug, Clone, Default)] -pub struct Surface { - pub start: SurfacePoint, - pub end: SurfacePoint, - pub flags: SurfaceFlags, -} - -impl Surface { - pub fn new(start: impl Into, end: impl Into) -> Self { - Self { - start: start.into(), - end: end.into(), - ..Default::default() - } - } - - pub fn ceiling(start: impl Into, end: impl Into) -> Self { - Self { - flags: SurfaceFlags::CEILING, - ..Self::new(start, end) - } - } - - pub fn floor(start: impl Into, end: impl Into) -> Self { - Self { - flags: SurfaceFlags::FLOOR, - ..Self::new(start, end) - } - } - - pub fn wall(start: impl Into, end: impl Into) -> Self { - Self { - flags: SurfaceFlags::WALL, - ..Self::new(start, end) - } - } - - /// Gets a reference to the left most facing point on the surface. - pub fn left(&self) -> &SurfacePoint { - if self.start.point.x < self.end.point.x { - &self.start - } else { - &self.end - } - } - - /// Gets a reference to the right most facing point on the surface. - pub fn right(&self) -> &SurfacePoint { - if self.start.point.x < self.end.point.x { - &self.end - } else { - &self.start - } - } - - pub fn is_wall(&self) -> bool { - self.flags.contains(SurfaceFlags::WALL) - } - - pub fn is_ceiling(&self) -> bool { - self.flags.contains(SurfaceFlags::CEILING) - } - - pub fn is_floor(&self) -> bool { - self.flags.contains(SurfaceFlags::FLOOR) - } - - pub fn as_segment(&self) -> LineSegment2D { - LineSegment2D::new(self.start.point, self.end.point) - } - - /// Checks if one of the ends of the surface is one of ends. - pub fn has_end(&self, point: Vec2) -> bool { - self.start.point == point || self.end.point == point - } - - /// Gets the other end of the surface, if available. - /// If the provided point is not either end, returns None. - pub fn other(&self, point: Vec2) -> Option<&SurfacePoint> { - if point == self.start.point { - Some(&self.end) - } else if point == self.end.point { - Some(&self.start) - } else { - None - } - } - - /// Gets the total change in X across the surface. - pub fn delta_x(&self) -> f32 { - (self.end.point.x - self.start.point.x).abs() - } - - /// Gets the total change in Y across the surface. - pub fn delta_y(&self) -> f32 { - (self.end.point.y - self.start.point.y).abs() - } - - pub fn contains_x(&self, x: f32) -> bool { - x >= self.left().point.x && x <= self.right().point.x - } - - pub fn contains_y(&self, y: f32) -> bool { - y >= self.left().point.y && y <= self.right().point.y - } -} - -#[derive(Debug, Clone, Default)] -pub struct SurfacePoint { - pub point: Vec2, - pub grabbable: bool, -} - -impl From for SurfacePoint { - fn from(point: Vec2) -> Self { - Self { - point, - ..Default::default() - } - } -} - -bitflags! { - #[derive(Default)] - pub struct SurfaceFlags : u8 { - const FLOOR = 1 << 0; - const CEILING = 1 << 1; - const WALL = 1 << 2; - const PASSTHROUGH = 1 << 3; - } -} diff --git a/editor/Cargo.toml b/editor/Cargo.toml deleted file mode 100644 index e7ee47b..0000000 --- a/editor/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "fc-editor" -version = "0.1.0" -authors = ["james7132 "] -edition = "2018" - -[dependencies] diff --git a/editor/src/main.rs b/editor/src/main.rs deleted file mode 100644 index e7a11a9..0000000 --- a/editor/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} diff --git a/game/Cargo.toml b/game/Cargo.toml deleted file mode 100644 index 8beb9ce..0000000 --- a/game/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "fc" -version = "0.1.0" -authors = ["james7132 "] -edition = "2018" - -[features] -default = [] -steam-restart = [] - -[dependencies] -serde = "1.0" -fc-core = { path = "../core" } -bevy-steamworks = "0.1" -anyhow = "1.0" -serde_json = "1.0" -bitflags = "1.2" -libm = "0.2" - -[dependencies.bevy] -version = "0.5" -default-features = false -features = ["bevy_winit", "render", "bevy_wgpu"] diff --git a/game/src/match/input.rs b/game/src/match/input.rs deleted file mode 100644 index ef7561e..0000000 --- a/game/src/match/input.rs +++ /dev/null @@ -1,26 +0,0 @@ -use bevy::prelude::*; -use fc_core::{input::*, player::Player}; - -pub(super) fn sample_input( - keyboard: Res>, - mut players: Query<(&InputSource, &mut PlayerInput), With>, -) { - players.for_each_mut(|(mapping, mut player_input)| { - player_input.tick(); - match mapping { - InputSource::None | InputSource::CPU => {} - InputSource::Keyboard { - movement, - smash, - buttons, - } => { - player_input.current = PlayerInputFrame { - movement: movement.sample(&keyboard), - smash: smash.sample(&keyboard), - buttons: buttons.evaluate_all(&keyboard), - }; - } - InputSource::Gamepad { .. } => {} - } - }); -} diff --git a/game/src/data.rs b/src/assets/mod.rs similarity index 98% rename from game/src/data.rs rename to src/assets/mod.rs index e49aff6..cbabed5 100644 --- a/game/src/data.rs +++ b/src/assets/mod.rs @@ -1,14 +1,14 @@ -use crate::AppState; +use crate::{ + character::{state::StateMachine, CharacterAsset}, + r#match::stage::StageAsset, + AppState, +}; use bevy::{ asset::{AssetLoader, LoadContext, LoadState, LoadedAsset}, prelude::*, reflect::TypeUuid, utils::BoxedFuture, }; -use fc_core::{ - character::{state::StateMachine, CharacterAsset}, - stage::StageAsset, -}; struct FcAssetLoader { extensions: &'static [&'static str], diff --git a/core/src/character/frame_data/hitbox.rs b/src/character/frame_data/hitbox.rs similarity index 100% rename from core/src/character/frame_data/hitbox.rs rename to src/character/frame_data/hitbox.rs diff --git a/core/src/character/frame_data/hurtbox.rs b/src/character/frame_data/hurtbox.rs similarity index 100% rename from core/src/character/frame_data/hurtbox.rs rename to src/character/frame_data/hurtbox.rs diff --git a/core/src/character/frame_data/mod.rs b/src/character/frame_data/mod.rs similarity index 100% rename from core/src/character/frame_data/mod.rs rename to src/character/frame_data/mod.rs diff --git a/core/src/character/mod.rs b/src/character/mod.rs similarity index 88% rename from core/src/character/mod.rs rename to src/character/mod.rs index 8c56288..7b3ba82 100644 --- a/core/src/character/mod.rs +++ b/src/character/mod.rs @@ -14,9 +14,3 @@ pub struct CharacterAsset { #[derive(Debug, Serialize, Deserialize)] pub struct CharacterPallette {} - -#[repr(u8)] -pub enum Facing { - Left, - Right, -} diff --git a/core/src/character/state/mod.rs b/src/character/state/mod.rs similarity index 100% rename from core/src/character/state/mod.rs rename to src/character/state/mod.rs diff --git a/core/src/character/state/state.rs b/src/character/state/state.rs similarity index 100% rename from core/src/character/state/state.rs rename to src/character/state/state.rs diff --git a/core/src/character/state/transition.rs b/src/character/state/transition.rs similarity index 97% rename from core/src/character/state/transition.rs rename to src/character/state/transition.rs index 3842398..acd3f8a 100644 --- a/core/src/character/state/transition.rs +++ b/src/character/state/transition.rs @@ -1,5 +1,5 @@ use super::state::StateId; -use crate::input::Buttons; +use crate::r#match::input::Buttons; use serde::{Deserialize, Serialize}; #[derive(Default, Debug, Serialize, Deserialize)] diff --git a/game/src/config.rs b/src/config.rs similarity index 100% rename from game/src/config.rs rename to src/config.rs diff --git a/core/src/debug/capsule/capsule.frag b/src/debug/capsule/capsule.frag similarity index 100% rename from core/src/debug/capsule/capsule.frag rename to src/debug/capsule/capsule.frag diff --git a/core/src/debug/capsule/capsule.vert b/src/debug/capsule/capsule.vert similarity index 100% rename from core/src/debug/capsule/capsule.vert rename to src/debug/capsule/capsule.vert diff --git a/core/src/debug/capsule/mod.rs b/src/debug/capsule/mod.rs similarity index 100% rename from core/src/debug/capsule/mod.rs rename to src/debug/capsule/mod.rs diff --git a/core/src/debug/line/line.frag b/src/debug/line/line.frag similarity index 100% rename from core/src/debug/line/line.frag rename to src/debug/line/line.frag diff --git a/core/src/debug/line/line.vert b/src/debug/line/line.vert similarity index 100% rename from core/src/debug/line/line.vert rename to src/debug/line/line.vert diff --git a/core/src/debug/line/mod.rs b/src/debug/line/mod.rs similarity index 99% rename from core/src/debug/line/mod.rs rename to src/debug/line/mod.rs index eb068ad..64cadf4 100644 --- a/core/src/debug/line/mod.rs +++ b/src/debug/line/mod.rs @@ -1,4 +1,4 @@ -use crate::{geo::*, player::Facing}; +use crate::{geo::*, r#match::physics::Facing}; /// This is a fork of the bevy_debug_lines plugin that has no long term lines. /// All lines last only one frame. use bevy::prelude::*; diff --git a/game/src/debug.rs b/src/debug/mod.rs similarity index 95% rename from game/src/debug.rs rename to src/debug/mod.rs index 64b3210..a33fcef 100644 --- a/game/src/debug.rs +++ b/src/debug/mod.rs @@ -1,16 +1,24 @@ -use crate::r#match::{hitbox::HitboxState, physics::Body}; +mod capsule; +mod line; + +use self::capsule::{Capsule, CapsuleGenerator, DebugCapsulesPlugin}; +use self::line::{DebugLines, DebugLinesPlugin}; + +use crate::{ + character::frame_data::{hitbox::Hitbox, hurtbox::Hurtbox}, + geo::*, + player::Player, + r#match::{ + hitbox::HitboxState, + physics::Body, + stage::{BlastZone, RespawnPoint, SpawnPoint, Surface}, + }, +}; use bevy::{ diagnostic::{Diagnostics, FrameTimeDiagnosticsPlugin}, math::*, prelude::*, }; -use fc_core::{ - character::frame_data::{hitbox::Hitbox, hurtbox::Hurtbox}, - debug::{Capsule, CapsuleGenerator, DebugCapsulesPlugin, DebugLinesPlugin}, - player::Player, - stage::{BlastZone, RespawnPoint, SpawnPoint, Surface}, -}; -pub use fc_core::{debug::DebugLines, geo::*}; const CROSS_SIZE: f32 = 0.25; const HITBOX_ALPHA: f32 = 0.25; diff --git a/src/editor.rs b/src/editor.rs new file mode 100644 index 0000000..222c526 --- /dev/null +++ b/src/editor.rs @@ -0,0 +1,5 @@ +use bevy::prelude::*; + +fn main() { + App::build().add_plugins(DefaultPlugins).run() +} diff --git a/game/src/main.rs b/src/game.rs similarity index 96% rename from game/src/main.rs rename to src/game.rs index e450c1d..b1f774f 100644 --- a/game/src/main.rs +++ b/src/game.rs @@ -1,15 +1,17 @@ #[macro_use] extern crate bitflags; +use crate::{player, r#match::input::*}; #[windows_subsystem = "windows"] use bevy::prelude::*; use bevy_steamworks::{AppId, SteamworksPlugin}; -use fc_core::input::*; use std::collections::HashMap; -mod data; +mod assets; +mod character; #[cfg(debug_assertions)] mod debug; +mod geo; mod input; mod r#match; mod time; @@ -38,7 +40,7 @@ fn create_input_source(arrow: ButtonAxis2D, jump: KeyCode) -> InputSour } fn main() { - // Restart the game if need be through Steam, otherwise set the AppId + // Restart the game if need be through Steam, otherwise set the AppId // to ensure proper initialzation. #[cfg(feature = "steam-restart")] if bevy_steamworks::restart_app_if_necessary(STEAM_APP_ID) { @@ -63,7 +65,7 @@ fn main() { .add_plugins(DefaultPlugins) .add_plugin(SteamworksPlugin) .add_plugin(input::FcInputPlugin) - .add_plugin(data::FcAssetsPlugin) + .add_plugin(assets::FcAssetsPlugin) .add_plugin(r#match::FcMatchPlugin) .insert_resource(Msaa { samples: 1 }) .insert_resource(MatchConfig { diff --git a/core/src/geo/bounds.rs b/src/geo/bounds.rs similarity index 100% rename from core/src/geo/bounds.rs rename to src/geo/bounds.rs diff --git a/core/src/geo/capsule.rs b/src/geo/capsule.rs similarity index 100% rename from core/src/geo/capsule.rs rename to src/geo/capsule.rs diff --git a/core/src/geo/mod.rs b/src/geo/mod.rs similarity index 100% rename from core/src/geo/mod.rs rename to src/geo/mod.rs diff --git a/core/src/geo/point.rs b/src/geo/point.rs similarity index 100% rename from core/src/geo/point.rs rename to src/geo/point.rs diff --git a/core/src/geo/segment.rs b/src/geo/segment.rs similarity index 100% rename from core/src/geo/segment.rs rename to src/geo/segment.rs diff --git a/game/src/input.rs b/src/input.rs similarity index 100% rename from game/src/input.rs rename to src/input.rs diff --git a/game/src/match/events.rs b/src/match/events.rs similarity index 77% rename from game/src/match/events.rs rename to src/match/events.rs index 0d0b71c..9640dd7 100644 --- a/game/src/match/events.rs +++ b/src/match/events.rs @@ -1,6 +1,5 @@ -use super::player::PlayerDamage; +use super::player::{Player, PlayerDamage}; use bevy::prelude::*; -use fc_core::player::Player; pub(super) struct PlayerDied { pub revive: bool, diff --git a/game/src/match/hitbox.rs b/src/match/hitbox.rs similarity index 97% rename from game/src/match/hitbox.rs rename to src/match/hitbox.rs index 3a339fe..dd39303 100644 --- a/game/src/match/hitbox.rs +++ b/src/match/hitbox.rs @@ -1,12 +1,15 @@ use super::{ - on_match_update, physics::Body, player::PlayerDamage, stage::StageContext, MatchState, + on_match_update, + physics::Body, + player::{Player, PlayerDamage, PlayerId}, + stage::StageContext, + MatchState, }; -use bevy::prelude::*; -use fc_core::{ +use crate::{ character::frame_data::{hitbox::Hitbox, hurtbox::Hurtbox, *}, geo::Capsule3D, - player::{Player, PlayerId}, }; +use bevy::prelude::*; use std::collections::HashMap; #[derive(Clone, Debug, Default)] diff --git a/core/src/input/mod.rs b/src/match/input.rs similarity index 88% rename from core/src/input/mod.rs rename to src/match/input.rs index 8bd21f1..1a90bf1 100644 --- a/core/src/input/mod.rs +++ b/src/match/input.rs @@ -1,5 +1,9 @@ -use bevy::math::{Vec2, Vec3}; -use bevy_input::{gamepad::GamepadButton, keyboard::KeyCode, Input}; +use super::player::Player; +use bevy::{ + input::{gamepad::GamepadButton, keyboard::KeyCode, Input}, + math::{Vec2, Vec3}, + prelude::*, +}; use serde::{Deserialize, Serialize}; use std::fmt; use std::{ @@ -303,3 +307,27 @@ impl ButtonMapping { return false; } } + +pub(super) fn sample_input( + keyboard: Res>, + mut players: Query<(&InputSource, &mut PlayerInput), With>, +) { + players.for_each_mut(|(mapping, mut player_input)| { + player_input.tick(); + match mapping { + InputSource::None | InputSource::CPU => {} + InputSource::Keyboard { + movement, + smash, + buttons, + } => { + player_input.current = PlayerInputFrame { + movement: movement.sample(&keyboard), + smash: smash.sample(&keyboard), + buttons: buttons.evaluate_all(&keyboard), + }; + } + InputSource::Gamepad { .. } => {} + } + }); +} diff --git a/game/src/match/mod.rs b/src/match/mod.rs similarity index 98% rename from game/src/match/mod.rs rename to src/match/mod.rs index 0377ab0..aaf5887 100644 --- a/game/src/match/mod.rs +++ b/src/match/mod.rs @@ -1,26 +1,25 @@ -use self::player::*; -use crate::AppState; +use self::{player::*, stage::*}; +use crate::{ + character::{frame_data::*, state::*}, + geo::*, + player::Player, + AppState, +}; use bevy::{ math::*, prelude::*, render::camera::{Camera, PerspectiveProjection}, window::Windows, }; -use fc_core::{ - character::{frame_data::*, state::*}, - geo::*, - player::Player, - stage::*, -}; use serde::{Deserialize, Serialize}; -mod events; +pub mod events; pub mod hitbox; -mod input; +pub mod input; pub mod physics; pub mod player; pub mod rule; -mod stage; +pub mod stage; pub const MAX_PLAYERS_PER_MATCH: usize = 4; diff --git a/game/src/match/physics.rs b/src/match/physics.rs similarity index 91% rename from game/src/match/physics.rs rename to src/match/physics.rs index de64df4..24d66d4 100644 --- a/game/src/match/physics.rs +++ b/src/match/physics.rs @@ -1,7 +1,6 @@ -use super::{on_match_update, player::PlayerMovement, stage::StageContext}; -use crate::time::FrameTimer; +use super::{input::PlayerInput, on_match_update, player::PlayerMovement, stage::StageContext}; +use crate::{geo::*, time::FrameTimer}; use bevy::{math::*, prelude::*}; -use fc_core::{geo::*, input::PlayerInput, player::Facing}; // TODO(james7132): Make these game config options. const DELTA_TIME: f32 = 1.0 / 60.0; @@ -57,6 +56,39 @@ impl Default for Location { } } +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum Facing { + Left = 0, + Right = 1, +} + +impl Default for Facing { + fn default() -> Self { + Self::Left + } +} + +impl Facing { + pub fn is_left(&self) -> bool { + *self == Self::Left + } + + pub fn is_right(&self) -> bool { + *self == Self::Left + } + + pub fn invert(&mut self) { + *self = self.inverted() + } + + pub fn inverted(&self) -> Self { + match self { + Self::Left => Self::Right, + Self::Right => Self::Left, + } + } +} + #[derive(Debug, Default)] pub struct Body { pub weight: f32, diff --git a/game/src/match/player.rs b/src/match/player.rs similarity index 95% rename from game/src/match/player.rs rename to src/match/player.rs index 2b075d4..a9f1e8d 100644 --- a/game/src/match/player.rs +++ b/src/match/player.rs @@ -1,14 +1,21 @@ -use super::{hitbox, physics}; -use bevy::prelude::*; -use fc_core::{ - character::{frame_data::*, state::*}, - input::*, - player::*, +use super::{ + hitbox, + input::{InputSource, PlayerInput}, + physics, }; +use crate::character::{frame_data::*, state::*}; +use bevy::prelude::*; use serde::{Deserialize, Serialize}; const PLAYER_COLORS: &[Color] = &[Color::RED, Color::BLUE, Color::YELLOW, Color::GREEN]; +pub type PlayerId = u8; + +#[derive(Debug, Default, Clone, PartialEq, Eq)] +pub struct Player { + pub id: PlayerId, +} + #[derive(Clone, Deserialize, Serialize)] pub struct PlayerConfig { /// The player's selected character in a match. diff --git a/game/src/match/rule.rs b/src/match/rule.rs similarity index 99% rename from game/src/match/rule.rs rename to src/match/rule.rs index aa5a756..8f8f557 100644 --- a/game/src/match/rule.rs +++ b/src/match/rule.rs @@ -4,8 +4,8 @@ use super::{ player::{PlayerConfig, PlayerDamage}, MatchConfig, MatchResult, MatchState, }; +use crate::player::Player; use bevy::{app::AppExit, prelude::*}; -use fc_core::player::Player; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone)] diff --git a/game/src/match/stage.rs b/src/match/stage.rs similarity index 54% rename from game/src/match/stage.rs rename to src/match/stage.rs index 426ec7d..76fbd3c 100644 --- a/game/src/match/stage.rs +++ b/src/match/stage.rs @@ -1,16 +1,169 @@ use super::{ events::PlayerDied, on_match_update, - physics::{Body, Location}, - player::PlayerDamage, + physics::{Body, Facing, Location}, + player::{Player, PlayerDamage}, }; -use crate::time::FrameTimer; -use bevy::{ecs::system::SystemParam, math::*, prelude::*}; -use fc_core::{ +use crate::{ geo::{Bounds2D, LineSegment2D}, - player::{Facing, Player}, - stage::{BlastZone, RespawnPoint, SpawnPoint, Surface}, + time::FrameTimer, }; +use bevy::{ecs::system::SystemParam, math::*, prelude::*, reflect::TypeUuid}; +use serde::{Deserialize, Serialize}; + +#[derive(Serialize, Deserialize, Debug, TypeUuid)] +#[uuid = "c0176bef-fe0f-4384-ae04-c9efa9a1918c"] +pub struct StageAsset { + pub name: String, +} + +#[derive(Debug, Clone)] +pub struct BlastZone(pub Bounds2D); + +#[derive(Debug, Clone)] +pub struct SpawnPoint { + pub position: Vec2, + pub facing: Facing, +} + +#[derive(Debug, Clone)] +pub struct RespawnPoint { + pub position: Vec2, + pub facing: Facing, + pub occupied_by: Option, +} + +#[derive(Debug, Clone, Default)] +pub struct Surface { + pub start: SurfacePoint, + pub end: SurfacePoint, + pub flags: SurfaceFlags, +} + +impl Surface { + pub fn new(start: impl Into, end: impl Into) -> Self { + Self { + start: start.into(), + end: end.into(), + ..Default::default() + } + } + + pub fn ceiling(start: impl Into, end: impl Into) -> Self { + Self { + flags: SurfaceFlags::CEILING, + ..Self::new(start, end) + } + } + + pub fn floor(start: impl Into, end: impl Into) -> Self { + Self { + flags: SurfaceFlags::FLOOR, + ..Self::new(start, end) + } + } + + pub fn wall(start: impl Into, end: impl Into) -> Self { + Self { + flags: SurfaceFlags::WALL, + ..Self::new(start, end) + } + } + + /// Gets a reference to the left most facing point on the surface. + pub fn left(&self) -> &SurfacePoint { + if self.start.point.x < self.end.point.x { + &self.start + } else { + &self.end + } + } + + /// Gets a reference to the right most facing point on the surface. + pub fn right(&self) -> &SurfacePoint { + if self.start.point.x < self.end.point.x { + &self.end + } else { + &self.start + } + } + + pub fn is_wall(&self) -> bool { + self.flags.contains(SurfaceFlags::WALL) + } + + pub fn is_ceiling(&self) -> bool { + self.flags.contains(SurfaceFlags::CEILING) + } + + pub fn is_floor(&self) -> bool { + self.flags.contains(SurfaceFlags::FLOOR) + } + + pub fn as_segment(&self) -> LineSegment2D { + LineSegment2D::new(self.start.point, self.end.point) + } + + /// Checks if one of the ends of the surface is one of ends. + pub fn has_end(&self, point: Vec2) -> bool { + self.start.point == point || self.end.point == point + } + + /// Gets the other end of the surface, if available. + /// If the provided point is not either end, returns None. + pub fn other(&self, point: Vec2) -> Option<&SurfacePoint> { + if point == self.start.point { + Some(&self.end) + } else if point == self.end.point { + Some(&self.start) + } else { + None + } + } + + /// Gets the total change in X across the surface. + pub fn delta_x(&self) -> f32 { + (self.end.point.x - self.start.point.x).abs() + } + + /// Gets the total change in Y across the surface. + pub fn delta_y(&self) -> f32 { + (self.end.point.y - self.start.point.y).abs() + } + + pub fn contains_x(&self, x: f32) -> bool { + x >= self.left().point.x && x <= self.right().point.x + } + + pub fn contains_y(&self, y: f32) -> bool { + y >= self.left().point.y && y <= self.right().point.y + } +} + +#[derive(Debug, Clone, Default)] +pub struct SurfacePoint { + pub point: Vec2, + pub grabbable: bool, +} + +impl From for SurfacePoint { + fn from(point: Vec2) -> Self { + Self { + point, + ..Default::default() + } + } +} + +bitflags! { + #[derive(Default)] + pub struct SurfaceFlags : u8 { + const FLOOR = 1 << 0; + const CEILING = 1 << 1; + const WALL = 1 << 2; + const PASSTHROUGH = 1 << 3; + } +} // TODO(james7132): Make this a game config option. const MAX_RESPAWN_FRAMES: u16 = 300; diff --git a/game/src/time.rs b/src/time.rs similarity index 100% rename from game/src/time.rs rename to src/time.rs