diff --git a/Cargo.lock b/Cargo.lock index 3a40664..dd52fe4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,6 +54,28 @@ 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" @@ -73,7 +95,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cbd542dd180566fad88fd2729a53a62a734843c626638006a9d63ec0688484e" dependencies = [ "android_log-sys 0.1.2", - "env_logger", + "env_logger 0.7.1", "lazy_static", "log", ] @@ -84,7 +106,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -120,7 +142,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c69a8137596e84c22d57f3da1b5de1d4230b1742a710091c85f4d7ce50f00f38" dependencies = [ - "libloading", + "libloading 0.6.7", ] [[package]] @@ -154,12 +176,29 @@ version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91831deabf0d6d7ec49552e489aed63b7456a7a3c46cff62adad428110b0af0" +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi 0.3.9", +] + [[package]] name = "autocfg" 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.10.1" @@ -223,7 +262,7 @@ dependencies = [ "crossbeam-channel", "downcast-rs", "js-sys", - "ndk-glue", + "ndk-glue 0.2.1", "notify", "parking_lot", "rand", @@ -235,6 +274,22 @@ dependencies = [ "web-sys", ] +[[package]] +name = "bevy_audio" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ca3cf9ce76696665e37a68b27ad6f6b0e2d0d85ccad36d8f018d3006812dbde" +dependencies = [ + "anyhow", + "bevy_app", + "bevy_asset", + "bevy_ecs", + "bevy_reflect", + "bevy_utils", + "parking_lot", + "rodio", +] + [[package]] name = "bevy_core" version = "0.5.0" @@ -277,6 +332,16 @@ dependencies = [ "parking_lot", ] +[[package]] +name = "bevy_dynamic_plugin" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3219befe938ee89dd8b2b78a02cfd835ef93fa930113a91631b093381005ed" +dependencies = [ + "bevy_app", + "libloading 0.7.0", +] + [[package]] name = "bevy_ecs" version = "0.5.0" @@ -310,6 +375,51 @@ dependencies = [ "syn", ] +[[package]] +name = "bevy_ecs_tilemap" +version = "0.2.0" +source = "git+https://github.com/StarArawn/bevy_ecs_tilemap?rev=50ec3c12c68079cf0d624e4dcade349351c3ae6c#50ec3c12c68079cf0d624e4dcade349351c3ae6c" +dependencies = [ + "bevy", + "dyn-clone", + "log", +] + +[[package]] +name = "bevy_gilrs" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b28a12e991a63fe044605aacf806b8dcdc5aa3af2d4482ba6cb9a1b74fc9392" +dependencies = [ + "bevy_app", + "bevy_ecs", + "bevy_input", + "bevy_utils", + "gilrs", +] + +[[package]] +name = "bevy_gltf" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9233bfb7e2cf053b51f01d2e57ea5a549438c0e5f08735d595b6a6504d00639e" +dependencies = [ + "anyhow", + "base64 0.13.0", + "bevy_app", + "bevy_asset", + "bevy_core", + "bevy_ecs", + "bevy_math", + "bevy_pbr", + "bevy_reflect", + "bevy_render", + "bevy_scene", + "bevy_transform", + "gltf", + "thiserror", +] + [[package]] name = "bevy_input" version = "0.5.0" @@ -330,10 +440,14 @@ checksum = "53c568981b2911567cba7f6dae7190bac295ffd411bca777edb1b5152b1ccd62" 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", "bevy_math", @@ -350,7 +464,7 @@ dependencies = [ "bevy_wgpu", "bevy_window", "bevy_winit", - "ndk-glue", + "ndk-glue 0.2.1", ] [[package]] @@ -544,6 +658,9 @@ version = "0.2.4" dependencies = [ "anyhow", "bevy", + "bevy_ecs_tilemap", + "env_logger 0.8.3", + "log", "tiled", ] @@ -653,6 +770,25 @@ 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", +] + [[package]] name = "bit-set" version = "0.5.2" @@ -698,6 +834,12 @@ 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" @@ -713,6 +855,21 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" +dependencies = [ + "nom", +] + [[package]] name = "cfg-if" version = "0.1.10" @@ -740,7 +897,18 @@ dependencies = [ "libc", "num-integer", "num-traits", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "clang-sys" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "853eda514c284c2287f4bf20ae614f8781f40a81d32ecda6e91449304dfe077c" +dependencies = [ + "glob", + "libc", + "libloading 0.7.0", ] [[package]] @@ -789,6 +957,16 @@ 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" @@ -814,6 +992,16 @@ 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" @@ -834,6 +1022,12 @@ 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" @@ -896,6 +1090,50 @@ 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", +] + +[[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 0.3.9", +] + [[package]] name = "crc32fast" version = "1.2.1" @@ -933,8 +1171,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a60cceb22c7c53035f8980524fdc7f17cf49681a3c154e6757d30afbec6ec4" dependencies = [ "bitflags", - "libloading", - "winapi", + "libloading 0.6.7", + "winapi 0.3.9", ] [[package]] @@ -993,6 +1231,12 @@ 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" @@ -1005,6 +1249,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +[[package]] +name = "dyn-clone" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2626afccd7561a06cf1367e2950c4718ea04565e20fb5029b6c7d8ad09abcf" + [[package]] name = "env_logger" version = "0.7.1" @@ -1015,6 +1265,19 @@ dependencies = [ "regex", ] +[[package]] +name = "env_logger" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "erased-serde" version = "0.3.13" @@ -1057,7 +1320,7 @@ dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1121,6 +1384,22 @@ dependencies = [ "libc", ] +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + [[package]] name = "futures-core" version = "0.3.13" @@ -1191,7 +1470,7 @@ dependencies = [ "bitflags", "gfx-auxil", "gfx-hal", - "libloading", + "libloading 0.6.7", "log", "parking_lot", "range-alloc", @@ -1199,7 +1478,7 @@ dependencies = [ "smallvec", "spirv_cross", "thunderdome", - "winapi", + "winapi 0.3.9", "wio", ] @@ -1221,7 +1500,7 @@ dependencies = [ "raw-window-handle", "smallvec", "spirv_cross", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1248,7 +1527,7 @@ dependencies = [ "glow", "js-sys", "khronos-egl", - "libloading", + "libloading 0.6.7", "log", "naga", "parking_lot", @@ -1301,7 +1580,7 @@ dependencies = [ "parking_lot", "raw-window-handle", "smallvec", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1316,6 +1595,38 @@ dependencies = [ "thiserror", ] +[[package]] +name = "gilrs" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e986f911d937f4395dfc2a39618dcef452773d32dcdbe0828c623f76588f749" +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 0.3.9", +] + [[package]] name = "glam" version = "0.13.0" @@ -1325,6 +1636,12 @@ dependencies = [ "serde", ] +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + [[package]] name = "glow" version = "0.7.2" @@ -1337,6 +1654,41 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gltf" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6fb0d1d772daf10ea74528c3aeb12215f6d5b820adf2ecfc93a6578d6779c3c" +dependencies = [ + "byteorder", + "gltf-json", + "lazy_static", +] + +[[package]] +name = "gltf-derive" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6636de7bf52227363554f1ca2d9cd180fc666129ddd0933097e1f227dfa7293" +dependencies = [ + "inflections", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "gltf-json" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3fc3deb81e6fa04bf808f6be7c3983229552a95b77f687ad96af00f6d3e7d6c" +dependencies = [ + "gltf-derive", + "serde", + "serde_derive", + "serde_json", +] + [[package]] name = "glyph_brush_layout" version = "0.2.1" @@ -1433,6 +1785,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "ident_case" version = "1.0.1" @@ -1452,6 +1810,7 @@ dependencies = [ "num-rational", "num-traits", "png", + "scoped_threadpool", ] [[package]] @@ -1464,6 +1823,12 @@ 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.2" @@ -1502,12 +1867,45 @@ 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 = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + [[package]] name = "itoa" 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" @@ -1533,13 +1931,23 @@ dependencies = [ ] [[package]] -name = "khronos-egl" -version = "3.0.2" +name = "kernel32-sys" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b19cc4a81304db2a0ad69740e83cdc3a9364e3f9bd6d88a87288a4c2deec927b" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "khronos-egl" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b19cc4a81304db2a0ad69740e83cdc3a9364e3f9bd6d88a87288a4c2deec927b" dependencies = [ "libc", - "libloading", + "libloading 0.6.7", ] [[package]] @@ -1548,6 +1956,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" version = "0.2.89" @@ -1573,7 +1987,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" dependencies = [ "cfg-if 1.0.0", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "libloading" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f84d96438c15fcd6c3f244c8fce01d1e2b9c6b5623e9c711dc9286d8fc92d6a" +dependencies = [ + "cfg-if 1.0.0", + "winapi 0.3.9", ] [[package]] @@ -1582,6 +2006,16 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" +[[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.2" @@ -1600,6 +2034,24 @@ 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" @@ -1618,6 +2070,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.3.4" @@ -1638,6 +2096,26 @@ 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" @@ -1647,6 +2125,25 @@ dependencies = [ "adler32", ] +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow 0.2.2", + "net2", + "slab", + "winapi 0.2.8", +] + [[package]] name = "mio" version = "0.7.10" @@ -1655,9 +2152,33 @@ checksum = "2182a122f3b7f3f5329cb1972cee089ba2459a0a80a56935e6e674f096f8d839" dependencies = [ "libc", "log", - "miow", + "miow 0.3.6", "ntapi", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "mio-extras" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" +dependencies = [ + "lazycell", + "log", + "mio 0.6.23", + "slab", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", ] [[package]] @@ -1667,7 +2188,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" dependencies = [ "socket2", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1694,7 +2215,19 @@ checksum = "5eb167c1febed0a496639034d0c76b3b74263636045db5489eee52143c246e73" dependencies = [ "jni-sys", "ndk-sys", - "num_enum", + "num_enum 0.4.3", + "thiserror", +] + +[[package]] +name = "ndk" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8794322172319b972f528bf90c6b467be0079f1fa82780ffb431088e741a73ab" +dependencies = [ + "jni-sys", + "ndk-sys", + "num_enum 0.5.1", "thiserror", ] @@ -1708,7 +2241,21 @@ dependencies = [ "lazy_static", "libc", "log", - "ndk", + "ndk 0.2.1", + "ndk-macro", + "ndk-sys", +] + +[[package]] +name = "ndk-glue" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5caf0c24d51ac1c905c27d4eda4fa0635bbe0de596b8f79235e0b17a4d29385" +dependencies = [ + "lazy_static", + "libc", + "log", + "ndk 0.3.0", "ndk-macro", "ndk-sys", ] @@ -1732,6 +2279,39 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" +[[package]] +name = "net2" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" +dependencies = [ + "memchr", + "version_check", +] + [[package]] name = "notify" version = "5.0.0-pre.6" @@ -1746,9 +2326,9 @@ dependencies = [ "fsevent-sys", "inotify", "libc", - "mio", + "mio 0.7.10", "walkdir", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1757,7 +2337,18 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "winapi", + "winapi 0.3.9", +] + +[[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]] @@ -1818,7 +2409,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca565a7df06f3d4b485494f25ba05da1435950f4dc263440eda7a6fa9b8e36e4" dependencies = [ "derivative", - "num_enum_derive", + "num_enum_derive 0.4.3", +] + +[[package]] +name = "num_enum" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "226b45a5c2ac4dd696ed30fa6b94b057ad909c7b7fc2e0d0808192bced894066" +dependencies = [ + "derivative", + "num_enum_derive 0.5.1", ] [[package]] @@ -1833,6 +2434,18 @@ dependencies = [ "syn", ] +[[package]] +name = "num_enum_derive" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c0fd9eba1d5db0994a239e09c1be402d35622277e35468ba891aa5e3188ce7e" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "objc" version = "0.2.7" @@ -1852,6 +2465,29 @@ 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" @@ -1895,9 +2531,21 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "winapi", + "winapi 0.3.9", ] +[[package]] +name = "peeking_take_while" +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 = "petgraph" version = "0.5.1" @@ -1914,6 +2562,12 @@ 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 = "png" version = "0.16.8" @@ -2062,6 +2716,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" +[[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" @@ -2073,6 +2737,32 @@ dependencies = [ "serde", ] +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "rusty-xinput" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2aa654bc32eb9ca14cce1a084abc9dfe43949a4547c35269a094c39272db3bb" +dependencies = [ + "lazy_static", + "log", + "winapi 0.3.9", +] + [[package]] name = "ryu" version = "1.0.5" @@ -2088,12 +2778,33 @@ 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", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.124" @@ -2125,6 +2836,12 @@ 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" @@ -2154,6 +2871,29 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" + +[[package]] +name = "slab" +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 0.3.9", +] + [[package]] name = "slotmap" version = "0.4.0" @@ -2177,7 +2917,7 @@ checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ "cfg-if 1.0.0", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2215,6 +2955,63 @@ 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", + "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 = "storage-map" version = "0.3.0" @@ -2263,6 +3060,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" +[[package]] +name = "termcolor" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.24" @@ -2432,6 +3238,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d" +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version_check" version = "0.9.3" @@ -2451,7 +3263,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" dependencies = [ "same-file", - "winapi", + "winapi 0.3.9", "winapi-util", ] @@ -2595,6 +3407,12 @@ dependencies = [ "bitflags", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -2605,6 +3423,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" @@ -2617,7 +3441,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -2642,15 +3466,19 @@ dependencies = [ "lazy_static", "libc", "log", - "ndk", - "ndk-glue", + "mio 0.6.23", + "mio-extras", + "ndk 0.2.1", + "ndk-glue 0.2.1", "ndk-sys", "objc", "parking_lot", + "percent-encoding", "raw-window-handle", "wasm-bindgen", "web-sys", - "winapi", + "winapi 0.3.9", + "x11-dl", ] [[package]] @@ -2659,7 +3487,29 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" dependencies = [ - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[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]] diff --git a/Cargo.toml b/Cargo.toml index 3af01b4..048f7dd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,5 +28,10 @@ web = [ [dependencies] anyhow = "1.0" -bevy = { version = "0.5", default-features = false } +bevy = { version = "0.5" } +bevy_ecs_tilemap = { git="https://github.com/StarArawn/bevy_ecs_tilemap", rev="50ec3c12c68079cf0d624e4dcade349351c3ae6c" } +log = "0.4" tiled = { version = "0.9", default-features = false } + +[dev-dependencies] +env_logger = "0.8" diff --git a/README.md b/README.md index 04f9220..414e06b 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ https://www.mapeditor.org/ Feel free to use this code as a reference for your own custom tile mapping solution as well. +This plugin uses bevy_ecs_tilemap(https://github.com/StarArawn/bevy_ecs_tilemap) to render tiled data. + ## Bevy Versions The `main` branch of this repository targets Bevy 0.5. When using bevy_tiled, please make sure your version of Bevy matches the version referenced by this library. There are versions for 0.4 and 0.3 as well. @@ -37,6 +39,7 @@ In these examples, you should be able to use the wasd keys to pan across the map # Features ## Toplevel Entity Support +TODO: REWRITE THIS SECTION For now, TiledMapBundle is just a configuration object. If you would like access to a toplevel entity that can be transformed, pass into the configuration: parent_option: Some(entity) @@ -44,6 +47,8 @@ For now, TiledMapBundle is just a configuration object. If you would like access Then, both chunks and objects will be inserted as children to this entity, which will be tagged with MapRoot. This API is likely to change, but we have an [example](/examples/parent_entity.rs) for how it currently works. ## Object Group Support +TODO: REWRITE THIS SECTION + Object Grous are now supported. They will be skipped if not visible. Individual objects that are invisible will be spawned with is_visible set to false. You may pass into the configuration object: @@ -83,6 +88,8 @@ Then when you save your map, it should update in the application. ## WASM and bevy_webgl2 +## TODO see if web still works? :/ + Use `default-features=false, features=["web"]` in your project's `Cargo.toml`. Tiled maps using Zstd compression are not supported. ## Top-needed features @@ -90,4 +97,4 @@ Use `default-features=false, features=["web"]` in your project's `Cargo.toml`. T * better support for isometric maps * support for embeded objects in tiles * support for embedded images in Tmx files - * support for animations + * ~~support for animations~~ done diff --git a/examples/iso_main.rs b/examples/iso_main.rs index 8c9599a..0951687 100644 --- a/examples/iso_main.rs +++ b/examples/iso_main.rs @@ -1,21 +1,23 @@ -use bevy::{prelude::*, render::camera::Camera}; -use bevy_tiled_prototype::TiledMapCenter; +use bevy::{app::CoreStage::PreUpdate, prelude::*, render::{camera::Camera}}; +use bevy_tiled_prototype::prelude::*; + +mod utils; fn main() { App::build() .add_plugins(DefaultPlugins) - .add_plugin(bevy_tiled_prototype::TiledMapPlugin) + .add_plugin(TiledMapPlugin) .add_system(bevy::input::system::exit_on_esc_system.system()) .add_startup_system(setup.system()) .add_system(camera_movement.system()) + // Needs to run before rendering to set texture atlas filter for new tiles- would be better to use states + .add_system_to_stage(PreUpdate, utils::texture_sampler::set_texture_filters_to_nearest.system()) .run(); } fn setup(mut commands: Commands, asset_server: Res) { - commands.spawn_bundle(bevy_tiled_prototype::TiledMapBundle { + commands.spawn_bundle(TiledMapBundle { map_asset: asset_server.load("iso-map.tmx"), - center: TiledMapCenter(true), - origin: Transform::from_scale(Vec3::new(4.0, 4.0, 1.0)), ..Default::default() }); commands.spawn_bundle(OrthographicCameraBundle::new_2d()); diff --git a/examples/ortho_debug.rs b/examples/ortho_debug.rs deleted file mode 100644 index 3dee569..0000000 --- a/examples/ortho_debug.rs +++ /dev/null @@ -1,38 +0,0 @@ -use bevy::prelude::*; -use bevy_tiled_prototype::{DebugConfig, Object, TiledMapCenter}; - -// this example demonstrates debugging objects. Hit spacebar to toggle them - -const SCALE: f32 = 2.0; - -fn main() { - App::build() - .add_plugins(DefaultPlugins) - .add_plugin(bevy_tiled_prototype::TiledMapPlugin) - .add_system(bevy::input::system::exit_on_esc_system.system()) - .add_system(toggle_debug.system()) - .add_startup_system(setup.system()) - .run(); -} - -fn setup(mut commands: Commands, asset_server: Res) { - commands.spawn_bundle(bevy_tiled_prototype::TiledMapBundle { - map_asset: asset_server.load("ortho-map.tmx"), - center: TiledMapCenter(true), - origin: Transform::from_scale(Vec3::new(SCALE, SCALE, 1.0)), - debug_config: DebugConfig { - enabled: true, - material: None, - }, - ..Default::default() - }); - commands.spawn_bundle(OrthographicCameraBundle::new_2d()); -} - -fn toggle_debug(keyboard_input: Res>, mut query: Query<&mut Visible, With>) { - for mut visible in query.iter_mut() { - if keyboard_input.just_released(KeyCode::Space) { - visible.is_visible = !visible.is_visible; - } - } -} diff --git a/examples/ortho_main.rs b/examples/ortho_main.rs index 60a8ebb..246ecd4 100644 --- a/examples/ortho_main.rs +++ b/examples/ortho_main.rs @@ -1,7 +1,13 @@ use bevy::{app::CoreStage::PreUpdate, prelude::*, render::camera::Camera}; -use bevy_tiled_prototype::{MapReadyEvent, TiledMapCenter}; +use bevy_tiled_prototype::prelude::*; + +mod utils; fn main() { + env_logger::Builder::from_default_env() + .filter_level(log::LevelFilter::Error) + .init(); + App::build() .add_plugins(DefaultPlugins) .add_plugin(bevy_tiled_prototype::TiledMapPlugin) @@ -9,15 +15,15 @@ fn main() { .add_startup_system(setup.system()) .add_system(camera_movement.system()) // Needs to run before rendering to set texture atlas filter for new tiles- would be better to use states - .add_system_to_stage(PreUpdate, set_texture_filters_to_nearest.system()) + .add_system_to_stage(PreUpdate, utils::texture_sampler::set_texture_filters_to_nearest.system()) .run(); } fn setup(mut commands: Commands, asset_server: Res) { - commands.spawn_bundle(bevy_tiled_prototype::TiledMapBundle { + asset_server.watch_for_changes().unwrap(); + + commands.spawn_bundle(TiledMapBundle { map_asset: asset_server.load("ortho-map.tmx"), - center: TiledMapCenter(true), - origin: Transform::from_scale(Vec3::new(4.0, 4.0, 1.0)), ..Default::default() }); commands.spawn_bundle(OrthographicCameraBundle::new_2d()); @@ -61,20 +67,3 @@ fn camera_movement( transform.translation += time.delta_seconds() * direction * 1000.; } } - -// demo of https://github.com/StarArawn/bevy_tiled/issues/47#issuecomment-817126515 -// Would be cleaner to put this in a separate AppState, transitioning out after textures loaded -fn set_texture_filters_to_nearest( - mut map_ready_events: EventReader, - mut textures: ResMut>, - texture_atlases: Res>, -) { - // quick and dirty, run this for all textures every time a map is created/modified - if map_ready_events.iter().count() > 0 { - for (_, atlas) in texture_atlases.iter() { - if let Some(texture) = textures.get_mut(atlas.texture.clone()) { - texture.sampler.min_filter = bevy::render::texture::FilterMode::Nearest; - } - } - } -} diff --git a/examples/parent_entity.rs b/examples/parent_entity.rs index c9da377..30c75ee 100644 --- a/examples/parent_entity.rs +++ b/examples/parent_entity.rs @@ -1,5 +1,5 @@ use bevy::prelude::*; -use bevy_tiled_prototype::{MapRoot, TiledMapCenter}; +use bevy_tiled_prototype::prelude::*; // this example demonstrates moving the map mesh entities using // the MapRoot marker on a passed-in parent element @@ -11,6 +11,8 @@ struct MovementData { transform: Transform, } +struct MapRoot; + fn main() { App::build() .insert_resource(MovementData::default()) @@ -34,14 +36,14 @@ fn setup(mut commands: Commands, asset_server: Res) { ..Default::default() }, )) + .insert(MapRoot) .id(); - commands.spawn_bundle(bevy_tiled_prototype::TiledMapBundle { - map_asset: asset_server.load("ortho-map.tmx"), - parent_option: Some(parent), - center: TiledMapCenter(true), - origin: Transform::from_scale(Vec3::new(4.0, 4.0, 1.0)), + commands.entity(parent).with_children(|child_builder| { + child_builder.spawn_bundle(TiledMapBundle { + map_asset: asset_server.load("ortho-map.tmx"), ..Default::default() + }); }); commands.spawn_bundle(OrthographicCameraBundle::new_2d()); } diff --git a/examples/utils/mod.rs b/examples/utils/mod.rs new file mode 100644 index 0000000..793fa05 --- /dev/null +++ b/examples/utils/mod.rs @@ -0,0 +1 @@ +pub mod texture_sampler; diff --git a/examples/utils/texture_sampler.rs b/examples/utils/texture_sampler.rs new file mode 100644 index 0000000..8ac7008 --- /dev/null +++ b/examples/utils/texture_sampler.rs @@ -0,0 +1,20 @@ +use bevy::{prelude::*, render::texture::FilterMode}; + +// demo of https://github.com/StarArawn/bevy_tiled/issues/47#issuecomment-817126515 +// Would be cleaner to put this in a separate AppState, transitioning out after textures loaded +pub fn set_texture_filters_to_nearest( + mut texture_events: EventReader>, + mut textures: ResMut>, +) { + // quick and dirty, run this for all textures every time a map is created/modified + for event in texture_events.iter() { + match event { + AssetEvent::Created { handle } => { + if let Some(mut texture) = textures.get_mut(handle){ + texture.sampler.min_filter = FilterMode::Nearest; + } + } + _ => () + } + } +} diff --git a/src/animation.rs b/src/animation.rs new file mode 100644 index 0000000..7d363ef --- /dev/null +++ b/src/animation.rs @@ -0,0 +1,38 @@ +use bevy::prelude::*; +use bevy_ecs_tilemap::prelude::Tile; + +/// Information specific to the current frame in the animation. +#[derive(Clone)] +pub struct Frame { + /// Tile id. + pub tile_id: u32, + /// Duration until next frame. + pub duration: f64, +} + +/// Information about the tiles animation state. +pub struct Animation { + /// Frame info. + pub frames: Vec, + /// The current frame. + pub current_frame: usize, + pub last_update: f64, +} + +pub fn update( + time: Res