Compare commits

..

15 commits

16 changed files with 599 additions and 527 deletions

504
Cargo.lock generated
View file

@ -123,6 +123,25 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "arboard"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc120354d1b5ec6d7aaf4876b602def75595937b5e15d356eb554ab5177e08bb"
dependencies = [
"clipboard-win",
"core-graphics 0.22.3",
"image 0.23.14",
"log",
"objc",
"objc-foundation",
"objc_id",
"parking_lot 0.12.1",
"thiserror",
"winapi",
"x11rb",
]
[[package]] [[package]]
name = "arrayvec" name = "arrayvec"
version = "0.7.2" version = "0.7.2"
@ -169,6 +188,12 @@ version = "4.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524"
[[package]]
name = "atomic_refcell"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d"
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
@ -190,6 +215,48 @@ dependencies = [
"bevy_internal", "bevy_internal",
] ]
[[package]]
name = "bevy-inspector-egui"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c53ed1cad011e33ea145d2c1f649a966e7457453f3768ddff39bc5064bd525"
dependencies = [
"bevy",
"bevy-inspector-egui-derive",
"bevy_egui",
"image 0.23.14",
"pretty-type-name",
]
[[package]]
name = "bevy-inspector-egui-derive"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48ef6260a46924d40781bcb9da157c110d5166bbd573795e4a16f2505913d0d0"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "bevy_animation"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4365465fca7bd78295eb81d0a04afc049399852793d562eb017849bb5d6c55e"
dependencies = [
"bevy_app",
"bevy_asset",
"bevy_core",
"bevy_ecs",
"bevy_hierarchy",
"bevy_math",
"bevy_reflect",
"bevy_time",
"bevy_transform",
"bevy_utils",
]
[[package]] [[package]]
name = "bevy_app" name = "bevy_app"
version = "0.8.1" version = "0.8.1"
@ -224,6 +291,7 @@ dependencies = [
"fastrand", "fastrand",
"js-sys", "js-sys",
"ndk-glue 0.5.2", "ndk-glue 0.5.2",
"notify",
"parking_lot 0.12.1", "parking_lot 0.12.1",
"serde", "serde",
"thiserror", "thiserror",
@ -348,6 +416,19 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "bevy_egui"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf44ff770566dca66b805a6829df783f64700bd01d35aec1034dff31b531a4"
dependencies = [
"arboard",
"bevy",
"egui",
"thread_local",
"webbrowser",
]
[[package]] [[package]]
name = "bevy_encase_derive" name = "bevy_encase_derive"
version = "0.8.1" version = "0.8.1"
@ -379,6 +460,7 @@ checksum = "79db7d7e71b47a69953fbe8407ded5c6308eaeecf9a05efd5dfb42992f400a16"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64", "base64",
"bevy_animation",
"bevy_app", "bevy_app",
"bevy_asset", "bevy_asset",
"bevy_core", "bevy_core",
@ -430,6 +512,7 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee63ad1e3f95a26ff2c227fadb1534a7bfe3a098e0e45c347f2f2575a573d9bc" checksum = "ee63ad1e3f95a26ff2c227fadb1534a7bfe3a098e0e45c347f2f2575a573d9bc"
dependencies = [ dependencies = [
"bevy_animation",
"bevy_app", "bevy_app",
"bevy_asset", "bevy_asset",
"bevy_audio", "bevy_audio",
@ -627,7 +710,7 @@ dependencies = [
"futures-lite", "futures-lite",
"hex", "hex",
"hexasphere", "hexasphere",
"image", "image 0.24.3",
"naga", "naga",
"once_cell", "once_cell",
"parking_lot 0.12.1", "parking_lot 0.12.1",
@ -983,6 +1066,17 @@ dependencies = [
"libloading", "libloading",
] ]
[[package]]
name = "clipboard-win"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4ab1b92798304eedc095b53942963240037c0516452cb11aeba709d420b2219"
dependencies = [
"error-code",
"str-buf",
"winapi",
]
[[package]] [[package]]
name = "cocoa" name = "cocoa"
version = "0.24.0" version = "0.24.0"
@ -1328,6 +1422,16 @@ dependencies = [
"syn", "syn",
] ]
[[package]]
name = "deflate"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174"
dependencies = [
"adler32",
"byteorder",
]
[[package]] [[package]]
name = "deflate" name = "deflate"
version = "1.0.0" version = "1.0.0"
@ -1349,12 +1453,32 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]]
name = "egui"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb095a8b9feb9b7ff8f00b6776dffcef059538a3f4a91238e03c900e9c9ad9a2"
dependencies = [
"ahash",
"epaint",
"nohash-hasher",
]
[[package]] [[package]]
name = "either" name = "either"
version = "1.8.0" version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
[[package]]
name = "emath"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c223f58c7e38abe1770f367b969f1b3fbd4704b67666bcb65dbb1adb0980ba72"
dependencies = [
"bytemuck",
]
[[package]] [[package]]
name = "encase" name = "encase"
version = "0.3.0" version = "0.3.0"
@ -1397,6 +1521,21 @@ dependencies = [
"regex", "regex",
] ]
[[package]]
name = "epaint"
version = "0.18.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c29567088888e8ac3e8f61bbb2ddc820207ebb8d69eefde5bcefa06d65e4e89"
dependencies = [
"ab_glyph",
"ahash",
"atomic_refcell",
"bytemuck",
"emath",
"nohash-hasher",
"parking_lot 0.12.1",
]
[[package]] [[package]]
name = "erased-serde" name = "erased-serde"
version = "0.3.23" version = "0.3.23"
@ -1406,6 +1545,16 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "error-code"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21"
dependencies = [
"libc",
"str-buf",
]
[[package]] [[package]]
name = "euclid" name = "euclid"
version = "0.22.7" version = "0.22.7"
@ -1430,6 +1579,18 @@ dependencies = [
"instant", "instant",
] ]
[[package]]
name = "filetime"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c"
dependencies = [
"cfg-if 1.0.0",
"libc",
"redox_syscall",
"windows-sys",
]
[[package]] [[package]]
name = "fixedbitset" name = "fixedbitset"
version = "0.4.2" version = "0.4.2"
@ -1457,6 +1618,25 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]]
name = "form_urlencoded"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191"
dependencies = [
"matches",
"percent-encoding",
]
[[package]]
name = "fsevent-sys"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.23" version = "0.3.23"
@ -1493,6 +1673,16 @@ dependencies = [
"byteorder", "byteorder",
] ]
[[package]]
name = "gethostname"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e"
dependencies = [
"libc",
"winapi",
]
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.7" version = "0.2.7"
@ -1730,6 +1920,33 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
[[package]]
name = "idna"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8"
dependencies = [
"matches",
"unicode-bidi",
"unicode-normalization",
]
[[package]]
name = "image"
version = "0.23.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24ffcb7e7244a9bf19d35bf2883b9c080c4ced3c07a9895572178cdb8f13f6a1"
dependencies = [
"bytemuck",
"byteorder",
"color_quant",
"num-iter",
"num-rational 0.3.2",
"num-traits",
"png 0.16.8",
"tiff",
]
[[package]] [[package]]
name = "image" name = "image"
version = "0.24.3" version = "0.24.3"
@ -1739,9 +1956,10 @@ dependencies = [
"bytemuck", "bytemuck",
"byteorder", "byteorder",
"color_quant", "color_quant",
"num-rational", "num-rational 0.4.1",
"num-traits", "num-traits",
"png", "png 0.17.5",
"scoped_threadpool",
] ]
[[package]] [[package]]
@ -1760,6 +1978,26 @@ version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a"
[[package]]
name = "inotify"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff"
dependencies = [
"bitflags",
"inotify-sys",
"libc",
]
[[package]]
name = "inotify-sys"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "inplace_it" name = "inplace_it"
version = "0.3.4" version = "0.3.4"
@ -1823,6 +2061,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "jpeg-decoder"
version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "229d53d58899083193af11e15917b5640cd40b29ff475a1fe4ef725deb02d0f2"
[[package]] [[package]]
name = "js-sys" name = "js-sys"
version = "0.3.59" version = "0.3.59"
@ -1843,6 +2087,26 @@ dependencies = [
"pkg-config", "pkg-config",
] ]
[[package]]
name = "kqueue"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d6112e8f37b59803ac47a42d14f1f3a59bbf72fc6857ffc5be455e28a691f8e"
dependencies = [
"kqueue-sys",
"libc",
]
[[package]]
name = "kqueue-sys"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587"
dependencies = [
"bitflags",
"libc",
]
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.4.0" version = "1.4.0"
@ -1922,14 +2186,17 @@ name = "lux-synthese"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"bevy", "bevy",
"bevy-inspector-egui",
"bevy_common_assets", "bevy_common_assets",
"bevy_mod_picking", "bevy_mod_picking",
"bevy_rapier2d", "bevy_rapier2d",
"crossbeam-channel",
"rand", "rand",
"rand_distr", "rand_distr",
"rapier2d", "rapier2d",
"serde", "serde",
"serde_json", "serde_json",
"ticktock",
] ]
[[package]] [[package]]
@ -1959,6 +2226,12 @@ dependencies = [
"regex-automata", "regex-automata",
] ]
[[package]]
name = "matches"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f"
[[package]] [[package]]
name = "matrixmultiply" name = "matrixmultiply"
version = "0.3.2" version = "0.3.2"
@ -2003,6 +2276,25 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435"
dependencies = [
"adler32",
]
[[package]]
name = "miniz_oxide"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
dependencies = [
"adler",
"autocfg",
]
[[package]] [[package]]
name = "miniz_oxide" name = "miniz_oxide"
version = "0.5.3" version = "0.5.3"
@ -2057,7 +2349,7 @@ dependencies = [
"matrixmultiply", "matrixmultiply",
"nalgebra-macros", "nalgebra-macros",
"num-complex", "num-complex",
"num-rational", "num-rational 0.4.1",
"num-traits", "num-traits",
"simba", "simba",
"typenum", "typenum",
@ -2165,6 +2457,19 @@ dependencies = [
"jni-sys", "jni-sys",
] ]
[[package]]
name = "nix"
version = "0.22.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e4916f159ed8e5de0082076562152a76b7a1f64a01fd9d1e0fea002c37624faf"
dependencies = [
"bitflags",
"cc",
"cfg-if 1.0.0",
"libc",
"memoffset",
]
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.23.1" version = "0.23.1"
@ -2189,6 +2494,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "nohash-hasher"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
[[package]] [[package]]
name = "nom" name = "nom"
version = "7.1.1" version = "7.1.1"
@ -2199,6 +2510,24 @@ dependencies = [
"minimal-lexical", "minimal-lexical",
] ]
[[package]]
name = "notify"
version = "5.0.0-pre.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "553f9844ad0b0824605c20fb55a661679782680410abfb1a8144c2e7e437e7a7"
dependencies = [
"bitflags",
"crossbeam-channel",
"filetime",
"fsevent-sys",
"inotify",
"kqueue",
"libc",
"mio",
"walkdir",
"winapi",
]
[[package]] [[package]]
name = "num-complex" name = "num-complex"
version = "0.4.2" version = "0.4.2"
@ -2229,6 +2558,28 @@ dependencies = [
"num-traits", "num-traits",
] ]
[[package]]
name = "num-iter"
version = "0.1.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]]
name = "num-rational"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07"
dependencies = [
"autocfg",
"num-integer",
"num-traits",
]
[[package]] [[package]]
name = "num-rational" name = "num-rational"
version = "0.4.1" version = "0.4.1"
@ -2291,6 +2642,17 @@ dependencies = [
"objc_exception", "objc_exception",
] ]
[[package]]
name = "objc-foundation"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9"
dependencies = [
"block",
"objc",
"objc_id",
]
[[package]] [[package]]
name = "objc_exception" name = "objc_exception"
version = "0.1.2" version = "0.1.2"
@ -2300,6 +2662,15 @@ dependencies = [
"cc", "cc",
] ]
[[package]]
name = "objc_id"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b"
dependencies = [
"objc",
]
[[package]] [[package]]
name = "oboe" name = "oboe"
version = "0.4.6" version = "0.4.6"
@ -2468,6 +2839,18 @@ version = "0.3.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
[[package]]
name = "png"
version = "0.16.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
dependencies = [
"bitflags",
"crc32fast",
"deflate 0.8.6",
"miniz_oxide 0.3.7",
]
[[package]] [[package]]
name = "png" name = "png"
version = "0.17.5" version = "0.17.5"
@ -2476,8 +2859,8 @@ checksum = "dc38c0ad57efb786dd57b9864e5b18bae478c00c824dc55a38bbc9da95dde3ba"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"crc32fast", "crc32fast",
"deflate", "deflate 1.0.0",
"miniz_oxide", "miniz_oxide 0.5.3",
] ]
[[package]] [[package]]
@ -2495,6 +2878,12 @@ version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
[[package]]
name = "pretty-type-name"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8815d101cfb4cb491154896bdab292a395a7ac9ab185a9941a2f5be0135900d"
[[package]] [[package]]
name = "proc-macro-crate" name = "proc-macro-crate"
version = "1.2.1" version = "1.2.1"
@ -2732,6 +3121,12 @@ dependencies = [
"winapi-util", "winapi-util",
] ]
[[package]]
name = "scoped_threadpool"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8"
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.1.0" version = "1.1.0"
@ -2852,6 +3247,12 @@ version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e"
[[package]]
name = "str-buf"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0"
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.10.0"
@ -2926,6 +3327,23 @@ dependencies = [
"once_cell", "once_cell",
] ]
[[package]]
name = "ticktock"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d226b8341a5d130e3446024468efab6d150ba656e086b793ac37a3d17669e626"
[[package]]
name = "tiff"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437"
dependencies = [
"jpeg-decoder",
"miniz_oxide 0.4.4",
"weezl",
]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.6.0" version = "1.6.0"
@ -3035,12 +3453,27 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "unicode-bidi"
version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.3" version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf" checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
[[package]]
name = "unicode-normalization"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6"
dependencies = [
"tinyvec",
]
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.9" version = "0.1.9"
@ -3053,6 +3486,18 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04" checksum = "957e51f3646910546462e67d5f7599b9e4fb8acdd304b087a6494730f9eebf04"
[[package]]
name = "url"
version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c"
dependencies = [
"form_urlencoded",
"idna",
"matches",
"percent-encoding",
]
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.1.2" version = "1.1.2"
@ -3180,6 +3625,26 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "webbrowser"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc6a3cffdb686fbb24d9fb8f03a213803277ed2300f11026a3afe1f108dc021b"
dependencies = [
"jni",
"ndk-glue 0.6.2",
"url",
"web-sys",
"widestring",
"winapi",
]
[[package]]
name = "weezl"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
[[package]] [[package]]
name = "wgpu" name = "wgpu"
version = "0.13.1" version = "0.13.1"
@ -3280,6 +3745,12 @@ dependencies = [
"safe_arch", "safe_arch",
] ]
[[package]]
name = "widestring"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983"
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.9" version = "0.3.9"
@ -3305,6 +3776,15 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "winapi-wsapoll"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
@ -3395,6 +3875,18 @@ dependencies = [
"pkg-config", "pkg-config",
] ]
[[package]]
name = "x11rb"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e99be55648b3ae2a52342f9a870c0e138709a3493261ce9b469afe6e4df6d8a"
dependencies = [
"gethostname",
"nix 0.22.3",
"winapi",
"winapi-wsapoll",
]
[[package]] [[package]]
name = "xi-unicode" name = "xi-unicode"
version = "0.3.0" version = "0.3.0"

View file

@ -6,22 +6,22 @@ license = "AGPL-3.0-only"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
bevy = { version = "0.8.1", default-features = false, features = ["bevy_asset", "bevy_audio", "bevy_gilrs", "bevy_winit", "render", "png", "vorbis", "x11"] } bevy = "0.8.1"
bevy_common_assets = { version = "0.3.0", features = ["json"] } bevy_common_assets = { version = "0.3.0", features = ["json"] }
bevy_rapier2d = "0.16.2" bevy_rapier2d = "0.16.2"
#crossbeam-channel = "0.5.6" crossbeam-channel = "0.5.6"
rand = "0.8.5" rand = "0.8.5"
rand_distr = "0.4.3" rand_distr = "0.4.3"
rapier2d = "0.14.0" rapier2d = "0.14.0"
serde = { version = "1.0.144", features = ["derive"] } serde = { version = "1.0.144", features = ["derive"] }
[target."cfg(not(target_arch = \"wasm32\"))".dependencies] [target."cfg(not(target_arch = \"wasm32\"))".dependencies]
#bevy-inspector-egui = "0.12.1" bevy-inspector-egui = "0.12.1"
bevy_mod_picking = "0.9.0" bevy_mod_picking = "0.9.0"
# cpal = "0.14.0" # cpal = "0.14.0"
# hexodsp = { git = "https://github.com/WeirdConstructor/HexoDSP", default-features = false } # hexodsp = { git = "https://github.com/WeirdConstructor/HexoDSP", default-features = false }
serde_json = "1.0.85" serde_json = "1.0.85"
#ticktock = "0.8.0" ticktock = "0.8.0"
[target."cfg(target_arch = \"wasm32\")".dependencies] [target."cfg(target_arch = \"wasm32\")".dependencies]
# cpal = { version = "0.14.0", features = ["wasm-bindgen"] } # cpal = { version = "0.14.0", features = ["wasm-bindgen"] }

View file

@ -1,15 +1,7 @@
# Lux synthesĕ # Lux synthesĕ
Combine colored lights to synthesize white light!
[Play in browser](https://txmn.tk/projects/lux-synthese/) [Play in browser](https://txmn.tk/projects/lux-synthese/)
Download: [Linux x86_64](https://txmn.tk/projects/lux-synthese/linux-x86_64.zip), [Windows x86_64](https://txmn.tk/projects/lux-synthese/windows-x86_64.zip)
In latin, _lux synthesĕ_ means "light by the means of synthesis".
This game was developped for the [Bevy Jam #2](https://itch.io/jam/bevy-jam-2).
## Controls ## Controls
* **Move**: arrows * **Move**: arrows
@ -22,10 +14,12 @@ This game was developped for the [Bevy Jam #2](https://itch.io/jam/bevy-jam-2).
## TODO ## TODO
* more filters * more filters
* despawn black characters
* despawn character when too far
* more levels * more levels
* (?) multiplayer * (?) multiplayer
* more audio * more audio
* bug: when reset after win, character colors are wrong * bug: in level2, move the blue character to win, then reset. The characters are lighter than expected. (also level 4)
* redshift warning * redshift warning
## Build ## Build
@ -36,6 +30,8 @@ cargo build --release
### WASM ### WASM
**Audio does not work in WASM!**
```bash ```bash
rustup target add wasm32-unknown-unknown rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli cargo install wasm-bindgen-cli
@ -48,20 +44,16 @@ python3 -m http.server
## Audio ## Audio
This game used [HexoDSP](https://github.com/WeirdConstructor/HexoDSP) for audio synthesis. This game uses [HexoDSP](https://github.com/WeirdConstructor/HexoDSP) for audio synthesis.
The synthetizer matrix can be edited using [HexoSynth](https://github.com/WeirdConstructor/HexoSynth) visual editor. The synthetizer matrix can be edited using [HexoSynth](https://github.com/WeirdConstructor/HexoSynth) visual editor.
However we could not get this working in WASM, hence we used simple playback audio instead for the jam. The concept of procedural audio is not abandonned but it will be for another time.
## Develop ## Develop
Skip to level `N: u32` with the command `bevyjam <N>`. Skip to level `N: u32` with the command `bevyjam <N>`.
Edit the level `N: u32` with the command `bevyjam <N> e`. Edit the level `N: u32` with the command `bevyjam <N> e`.
Editor is not available in the WASM build.
### Editor controls ### Editor controls
* **Select**: left click to select, click in void to deselect, CTRL+click to select many, CTRL+A to select all * **Select**: left click to select, click in void to deselect, CTRL+click to select many, CTRL+A to select all

View file

@ -301,12 +301,12 @@
0.0 0.0
], ],
"font_size": 32.0, "font_size": 32.0,
"text": "Let's rotate the hue!\nPress Space to jump." "text": "Let's rotate the hue!"
} }
] ]
}, },
{ {
"comment": "Melty platform tutorial", "comment": "Melting platform tutorial",
"characters": [ "characters": [
{ {
"pos": [ "pos": [
@ -384,389 +384,6 @@
}, },
{ {
"comment": "First puzzle", "comment": "First puzzle",
"characters": [
{
"pos": [
-96.0,
472.0
],
"color": [
1.0,
0.0,
0.0,
1.0
]
},
{
"pos": [
-264.0,
472.0
],
"color": [
0.0,
1.0,
0.0,
1.0
]
},
{
"pos": [
648.0,
600.0
],
"color": [
1.0,
0.0,
0.7,
1.0
]
},
{
"pos": [
648.0,
-8.0
],
"color": [
0.0,
1.0,
0.3,
1.0
]
}
],
"platforms": [
{
"pos": [
-168.0,
424.0
],
"size": [
464.0,
16.0
]
},
{
"pos": [
432.0,
424.0
],
"size": [
352.0,
16.0
]
},
{
"pos": [
156.0,
152.0
],
"size": [
312.0,
16.0
]
},
{
"pos": [
352.0,
-208.0
],
"size": [
176.0,
16.0
]
},
{
"pos": [
484.0,
-56.0
],
"size": [
104.0,
16.0
]
},
{
"pos": [
360.0,
64.0
],
"size": [
96.0,
16.0
]
},
{
"pos": [
64.0,
-272.0
],
"size": [
320.0,
16.0
]
},
{
"pos": [
600.0,
716.0
],
"size": [
16.0,
312.0
]
},
{
"pos": [
696.0,
412.0
],
"size": [
16.0,
920.0
]
},
{
"pos": [
600.0,
232.0
],
"size": [
16.0,
368.0
]
},
{
"pos": [
600.0,
-8.0
],
"size": [
16.0,
80.0
]
},
{
"pos": [
576.0,
56.0
],
"size": [
32.0,
16.0
]
},
{
"pos": [
564.0,
40.0
],
"size": [
8.0,
16.0
]
}
],
"absorbing_filters": [
{
"pos": [
56.0,
492.0
],
"size": [
16.0,
120.0
],
"color": [
1.0,
0.0,
0.0,
1.0
]
},
{
"pos": [
56.0,
628.0
],
"size": [
16.0,
152.0
],
"color": [
0.0,
1.0,
0.0,
1.0
]
},
{
"pos": [
264.0,
492.0
],
"size": [
16.0,
120.0
],
"color": [
0.0,
1.0,
0.0,
1.0
]
},
{
"pos": [
264.0,
628.0
],
"size": [
16.0,
152.0
],
"color": [
1.0,
0.0,
0.0,
1.0
]
},
{
"pos": [
-48.0,
152.0
],
"size": [
96.0,
16.0
],
"color": [
0.0,
0.0,
1.0,
1.0
]
},
{
"pos": [
600.0,
488.0
],
"size": [
16.0,
112.0
],
"color": [
0.0,
1.0,
1.0,
1.0
]
},
{
"pos": [
524.0,
556.0
],
"size": [
56.0,
8.0
],
"color": [
0.0,
1.0,
1.0,
1.0
]
}
],
"rotating_filters": [
{
"pos": [
-48.0,
40.0
],
"angle": -120.0
}
],
"melty_platforms": [
{
"pos": [
112.0,
424.0
],
"color": [
1.0,
0.0,
0.0,
1.0
]
},
{
"pos": [
208.0,
424.0
],
"color": [
1.0,
0.0,
0.0,
1.0
]
},
{
"pos": [
208.0,
288.0
],
"color": [
1.0,
0.0,
0.0,
1.0
]
},
{
"pos": [
600.0,
552.0
],
"color": [
0.0,
1.0,
1.0,
1.0
]
},
{
"pos": [
616.0,
40.0
],
"color": [
1.0,
0.0,
0.0,
1.0
]
},
{
"pos": [
584.0,
-56.0
],
"color": [
1.0,
0.0,
0.0,
1.0
]
}
],
"texts": []
},
{
"comment": "Second puzzle",
"characters": [ "characters": [
{ {
"pos": [ "pos": [

Binary file not shown.

View file

@ -1,11 +1,9 @@
# WASM
sh build-wasm.sh || exit 1 sh build-wasm.sh || exit 1
mkdir -p target/itchio/wasm/target mkdir -p target/itchio/wasm/target
mkdir -p target/itchio/wasm/assets mkdir -p target/itchio/wasm/assets
cp -r assets/* target/itchio/wasm/assets/ cp assets/* target/itchio/wasm/assets/
cp index.html target/itchio/wasm/ cp index.html target/itchio/wasm/
cp target/lux-synthese.js target/itchio/wasm/target/ cp target/lux-synthese.js target/itchio/wasm/target/
cp target/lux-synthese_bg.wasm target/itchio/wasm/target/ cp target/lux-synthese_bg.wasm target/itchio/wasm/target/

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -57,12 +57,10 @@ a, a:visited {
import init from './target/lux-synthese.js' import init from './target/lux-synthese.js'
init() init()
</script> </script>
<!-- workaround to be sure the browser will request permission to autoplay audio -->
<audio autoplay src="assets/silence.ogg"></audio>
<div id="readme"> <div id="readme">
<h1>Lux synthesĕ</h1> <h1>Lux synthesĕ</h1>
<p> <p>
<strong>If audio does not work, please allow media autoplay in browser, then refresh this page.</strong> <strong>Note</strong>: audio does not work in the WASM build.
</p> </p>
<h2>Controls</h2> <h2>Controls</h2>
<ul> <ul>
@ -71,12 +69,6 @@ init()
<li><strong>Level up</strong>: Enter</li> <li><strong>Level up</strong>: Enter</li>
<li><strong>Reset</strong>: R</li> <li><strong>Reset</strong>: R</li>
</ul> </ul>
<h2>Download</h2>
Download an executable release:
<ul>
<li><a href="https://txmn.tk/projects/lux-synthese/linux-x86_64.zip">Linux x86_64</a></li>
<li><a href="https://txmn.tk/projects/lux-synthese/windows-x86_64.zip">Windows x86_64</a></li>
</ul>
<h2>Source</h2> <h2>Source</h2>
<p> <p>
The source code of this free software is available in our <a href="https://git.txmn.tk/tuxmain/bevyjam/">Git repository</a>. The source code of this free software is available in our <a href="https://git.txmn.tk/tuxmain/bevyjam/">Git repository</a>.

View file

@ -4,7 +4,8 @@ pub struct AudioSystemPlugin;
impl Plugin for AudioSystemPlugin { impl Plugin for AudioSystemPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.init_resource::<AudioAssets>() app
.init_resource::<AudioAssets>()
.add_startup_system(load_audio); .add_startup_system(load_audio);
} }
} }
@ -25,22 +26,22 @@ pub fn play_audio(
for i in 0 .. 3 { for i in 0 .. 3 {
audio.play_with_settings( audio.play_with_settings(
audio_set[i].clone(), audio_set[i].clone(),
PlaybackSettings::ONCE.with_volume(color[i] * volume), PlaybackSettings::ONCE.with_volume(color[i] * volume)
); );
} }
} }
fn load_audio(mut audio_assets: ResMut<AudioAssets>, asset_server: Res<AssetServer>) { fn load_audio(
mut audio_assets: ResMut<AudioAssets>,
asset_server: Res<AssetServer>,
) {
audio_assets.notes[0] = asset_server.load::<AudioSource, &str>("sound/notes/a5.ogg"); audio_assets.notes[0] = asset_server.load::<AudioSource, &str>("sound/notes/a5.ogg");
audio_assets.notes[1] = asset_server.load::<AudioSource, &str>("sound/notes/cs6.ogg"); audio_assets.notes[1] = asset_server.load::<AudioSource, &str>("sound/notes/cs6.ogg");
audio_assets.notes[2] = asset_server.load::<AudioSource, &str>("sound/notes/e6.ogg"); audio_assets.notes[2] = asset_server.load::<AudioSource, &str>("sound/notes/e6.ogg");
audio_assets.reverb_notes[0] = audio_assets.reverb_notes[0] = asset_server.load::<AudioSource, &str>("sound/reverb_notes/a5.ogg");
asset_server.load::<AudioSource, &str>("sound/reverb_notes/a5.ogg"); audio_assets.reverb_notes[1] = asset_server.load::<AudioSource, &str>("sound/reverb_notes/cs6.ogg");
audio_assets.reverb_notes[1] = audio_assets.reverb_notes[2] = asset_server.load::<AudioSource, &str>("sound/reverb_notes/e6.ogg");
asset_server.load::<AudioSource, &str>("sound/reverb_notes/cs6.ogg");
audio_assets.reverb_notes[2] =
asset_server.load::<AudioSource, &str>("sound/reverb_notes/e6.ogg");
audio_assets.warp_notes[0] = asset_server.load::<AudioSource, &str>("sound/warp_notes/a5.ogg"); audio_assets.warp_notes[0] = asset_server.load::<AudioSource, &str>("sound/warp_notes/a5.ogg");
audio_assets.warp_notes[1] = asset_server.load::<AudioSource, &str>("sound/warp_notes/cs6.ogg"); audio_assets.warp_notes[1] = asset_server.load::<AudioSource, &str>("sound/warp_notes/cs6.ogg");

View file

@ -23,10 +23,6 @@ impl PassThroughFilter {
PassThroughFilter::Rotating(filter_angle) => { PassThroughFilter::Rotating(filter_angle) => {
let mut hsla = color.as_hsla_f32(); let mut hsla = color.as_hsla_f32();
hsla[0] = (hsla[0] + filter_angle) % 360.; hsla[0] = (hsla[0] + filter_angle) % 360.;
// floating rem is not modulo!
if hsla[0] < 0. {
hsla[0] += 360.;
}
Color::hsla(hsla[0], hsla[1], hsla[2], hsla[3]) Color::hsla(hsla[0], hsla[1], hsla[2], hsla[3])
} }
} }

View file

@ -2,8 +2,8 @@
#![allow(clippy::too_many_arguments)] #![allow(clippy::too_many_arguments)]
pub use crate::filters::*; pub use crate::filters::*;
use crate::{AppState, audio_system};
use crate::levels; use crate::levels;
use crate::{audio_system, AppState};
use bevy::{ use bevy::{
ecs::system::EntityCommands, ecs::system::EntityCommands,
@ -25,7 +25,6 @@ pub struct GamePlugin;
impl Plugin for GamePlugin { impl Plugin for GamePlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_event::<LevelStartupEvent>() app.add_event::<LevelStartupEvent>()
.add_event::<ChangeCharacterEvent>()
.init_resource::<CharacterMeshes>() .init_resource::<CharacterMeshes>()
.insert_resource(CurrentLevel(None)) .insert_resource(CurrentLevel(None))
.init_resource::<CharacterList>() .init_resource::<CharacterList>()
@ -42,8 +41,7 @@ impl Plugin for GamePlugin {
.with_system(player_movement_system) .with_system(player_movement_system)
.with_system(level_keyboard_system) .with_system(level_keyboard_system)
.with_system(camera_system) .with_system(camera_system)
.with_system(character_particle_effect_system) .with_system(character_particle_effect_system),
.with_system(kill_character_system),
) )
.add_system_set( .add_system_set(
SystemSet::on_update(AppState::Win) SystemSet::on_update(AppState::Win)
@ -67,8 +65,6 @@ impl Plugin for GamePlugin {
pub struct LevelStartupEvent; pub struct LevelStartupEvent;
pub struct ChangeCharacterEvent;
// Resources // Resources
pub struct CurrentLevel(pub Option<LevelId>); pub struct CurrentLevel(pub Option<LevelId>);
@ -159,16 +155,24 @@ pub fn spawn_characters<I: IntoIterator<Item = (Transform, Color)>>(
characters: I, characters: I,
) { ) {
const Z_INCREMENT: f32 = 0.01;
let mut curr_z: f32 = Z_INCREMENT;
for (i, (transform, color)) in characters.into_iter().enumerate() { for (i, (transform, color)) in characters.into_iter().enumerate() {
spawn_character( spawn_character(
commands, commands,
character_meshes, character_meshes,
materials, materials,
character_list, character_list,
transform, {
let mut new_transform: Transform = transform;
new_transform.translation.z = curr_z;
new_transform
},
color, color,
i == 0, i == 0,
); );
curr_z += Z_INCREMENT;
} }
} }
@ -307,8 +311,7 @@ fn char_char_collision_event_system(
if let ( if let (
Ok((c1_color, c1_transform, c1_player)), Ok((c1_color, c1_transform, c1_player)),
Ok((c2_color, c2_transform, c2_player)), Ok((c2_color, c2_transform, c2_player)),
) = (character_query.get(*e1), character_query.get(*e2)) ) = (character_query.get(*e1), character_query.get(*e2)) {
{
character_list.0.remove(e1); character_list.0.remove(e1);
character_list.0.remove(e2); character_list.0.remove(e2);
commands.entity(*e1).despawn_recursive(); commands.entity(*e1).despawn_recursive();
@ -341,7 +344,7 @@ fn char_char_collision_event_system(
c1_player.is_some() || c2_player.is_some(), c1_player.is_some() || c2_player.is_some(),
); );
audio_system::play_audio(&audio_assets.warp_notes, &audio, new_color, 1.0); audio_system::play_audio(&audio_assets.warp_notes, &audio, new_color.into(), 1.0);
} }
} }
} }
@ -398,8 +401,6 @@ fn collision_event_system(
)>, )>,
pass_through_filter_query: Query<&PassThroughFilter>, pass_through_filter_query: Query<&PassThroughFilter>,
melty_query: Query<&Melty>, melty_query: Query<&Melty>,
mut character_list: ResMut<CharacterList>,
mut change_character_event: EventWriter<ChangeCharacterEvent>,
) { ) {
for collision_event in collision_events.iter() { for collision_event in collision_events.iter() {
if let CollisionEvent::Started(e1, e2, flags) = collision_event { if let CollisionEvent::Started(e1, e2, flags) = collision_event {
@ -418,34 +419,21 @@ fn collision_event_system(
} }
} }
} else if *flags == CollisionEventFlags::SENSOR { } else if *flags == CollisionEventFlags::SENSOR {
if let (Ok((mut c_color, _c_transform, mut c_material, c_player)), Ok(filter)) = ( if let (Ok((mut c_color, _c_transform, mut c_material, _c_player)), Ok(filter)) = (
character_query.get_mut(*e1), character_query.get_mut(*e1),
pass_through_filter_query.get(*e2), pass_through_filter_query.get(*e2),
) { ) {
c_color.0 = filter.apply(c_color.0); c_color.0 = filter.apply(c_color.0);
if c_color.0.as_hsla_f32()[2] < 0.1 {
commands.entity(*e1).despawn_recursive();
character_list.0.remove(e1);
if c_player.is_some() {
change_character_event.send(ChangeCharacterEvent);
}
}
*c_material = materials.add(ColorMaterial::from(c_color.0)); *c_material = materials.add(ColorMaterial::from(c_color.0));
} else if let ( } else if let (
Ok((mut c_color, _c_transform, mut c_material, c_player)), Ok((mut c_color, _c_transform, mut c_material, _c_player)),
Ok(filter), Ok(filter),
) = ( ) = (
character_query.get_mut(*e2), character_query.get_mut(*e2),
pass_through_filter_query.get(*e1), pass_through_filter_query.get(*e1),
) { ) {
c_color.0 = filter.apply(c_color.0); c_color.0 = filter.apply(c_color.0);
if c_color.0.as_hsla_f32()[2] < 0.1 {
commands.entity(*e2).despawn_recursive();
character_list.0.remove(e2);
if c_player.is_some() {
change_character_event.send(ChangeCharacterEvent);
}
}
*c_material = materials.add(ColorMaterial::from(c_color.0)); *c_material = materials.add(ColorMaterial::from(c_color.0));
} }
} }
@ -455,14 +443,14 @@ fn collision_event_system(
fn change_character_system( fn change_character_system(
mut commands: Commands, mut commands: Commands,
keyboard_input: Res<Input<KeyCode>>, keyboard_input: Res<Input<KeyCode>>,
characters: Query<(Entity, &CharacterColor, Option<&Player>)>, characters: Query<(Entity, &CharacterColor, Option<&Player>)>,
character_list: Res<CharacterList>, character_list: Res<CharacterList>,
audio_assets: Res<audio_system::AudioAssets>, audio_assets: Res<audio_system::AudioAssets>,
audio: Res<Audio>, audio: Res<Audio>,
change_character_event: EventReader<ChangeCharacterEvent>,
) { ) {
if !keyboard_input.just_pressed(KeyCode::Tab) && change_character_event.is_empty() { if !keyboard_input.just_pressed(KeyCode::Tab) {
return; return;
} }
@ -501,8 +489,7 @@ fn player_movement_system(
for (mut velocity, children, color) in characters.iter_mut() { for (mut velocity, children, color) in characters.iter_mut() {
velocity.linvel.x = 200. * (right_pressed as i8 - left_pressed as i8) as f32; velocity.linvel.x = 200. * (right_pressed as i8 - left_pressed as i8) as f32;
let mut platform_count: Mut<PlatformCount> = let mut platform_count: Mut<PlatformCount> = platform_count_query.get_mut(children[0]).unwrap();
platform_count_query.get_mut(children[0]).unwrap();
if keyboard_input.just_pressed(KeyCode::Space) && platform_count.is_landed() { if keyboard_input.just_pressed(KeyCode::Space) && platform_count.is_landed() {
audio_system::play_audio(&audio_assets.notes, &audio, color.0.into(), 0.5); audio_system::play_audio(&audio_assets.notes, &audio, color.0.into(), 0.5);
velocity.linvel.y = 700.; velocity.linvel.y = 700.;
@ -566,8 +553,8 @@ fn camera_system(
time: Res<Time>, time: Res<Time>,
mut zoom_timer: ResMut<levels::ZoomTimer>, mut zoom_timer: ResMut<levels::ZoomTimer>,
) { ) {
fn lerp(x: f32, y: f32, t: f32) -> f32 { fn lerp(x: f32, y: f32, t: f32,) -> f32 {
((y - x) * t) + x return ((y - x) * t) + x;
} }
const MARGIN: f32 = 300.0; const MARGIN: f32 = 300.0;
@ -635,28 +622,7 @@ fn level_keyboard_system(
commands.entity(entity).despawn_recursive(); commands.entity(entity).despawn_recursive();
} }
if app_state.replace(AppState::Game).is_err() { if app_state.replace(AppState::Game).is_err() {
crate::levels::setup_level( crate::levels::setup_level(&mut level_startup_event, &mut camera_query, &mut zoom_timer);
&mut level_startup_event,
&mut camera_query,
&mut zoom_timer,
);
}
}
}
fn kill_character_system(
mut commands: Commands,
character_query: Query<(Entity, &Transform, Option<&Player>), With<CharacterColor>>,
mut character_list: ResMut<CharacterList>,
mut change_character_event: EventWriter<ChangeCharacterEvent>,
) {
for (entity, transform, player) in character_query.iter() {
if transform.translation.y < -512. {
commands.entity(entity).despawn_recursive();
character_list.0.remove(&entity);
if player.is_some() {
change_character_event.send(ChangeCharacterEvent);
}
} }
} }
} }

View file

@ -14,7 +14,9 @@ pub struct ZoomTimer(pub Timer);
impl Default for ZoomTimer { impl Default for ZoomTimer {
fn default() -> Self { fn default() -> Self {
Self(Timer::new(Duration::new(2, 0), false)) Self {
0: Timer::new(Duration::new(2, 0), false),
}
} }
} }

View file

@ -3,12 +3,12 @@
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]
mod editor; mod editor;
mod audio_system;
mod filters; mod filters;
mod game; mod game;
mod levels; mod levels;
mod menu; mod menu;
mod particle_effect; mod particle_effect;
mod audio_system;
use bevy::{ use bevy::{
asset::{Asset, HandleId, LoadState}, asset::{Asset, HandleId, LoadState},

View file

@ -20,6 +20,22 @@ impl Plugin for MenuPlugin {
fn setup(mut commands: Commands, asset_server: Res<AssetServer>) { fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
let font = asset_server.get_handle("UacariLegacy-Thin.ttf"); let font = asset_server.get_handle("UacariLegacy-Thin.ttf");
#[cfg(target_arch = "wasm32")]
commands
.spawn_bundle(Text2dBundle {
text: Text::from_section(
"Note:\nAudio is NOT available in the WASM build.",
TextStyle {
font: font.clone(),
font_size: 24.0,
color: Color::rgba(1., 0.4, 0.4, 1.),
},
)
.with_alignment(TextAlignment::CENTER),
transform: Transform::from_xyz(0., -128.0, 0.),
..Default::default()
})
.insert(Menu);
commands commands
.spawn_bundle(Text2dBundle { .spawn_bundle(Text2dBundle {
text: Text::from_section( text: Text::from_section(