Game stats that reset every frame, inspired by immediate mode GUI.
gamedev bevy stats
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #26 from AlephCubed/dev

Overhaul `bevy_auto_plugin` feature.

authored by

Josiah Nelson and committed by
GitHub
13a32951 7640082a

+161 -330
+97 -132
Cargo.lock
··· 43 43 dependencies = [ 44 44 "proc-macro2", 45 45 "quote", 46 - "syn 2.0.111", 46 + "syn 2.0.114", 47 47 ] 48 48 49 49 [[package]] ··· 115 115 "cfg-if", 116 116 "downcast-rs", 117 117 "log", 118 - "thiserror 2.0.17", 118 + "thiserror 2.0.18", 119 119 "variadics_please", 120 120 ] 121 121 122 122 [[package]] 123 123 name = "bevy_auto_plugin" 124 - version = "0.9.0" 124 + version = "0.10.0" 125 125 source = "registry+https://github.com/rust-lang/crates.io-index" 126 - checksum = "b00355e2dd268a7f9c7453773753edfedda475896c0b4e7b2d015aa04f4849fd" 126 + checksum = "f3c7761957a70588bf0b7c6120c97a47620dab684a622a0aa0a8c5c9161becd6" 127 127 dependencies = [ 128 128 "bevy_auto_plugin_proc_macros", 129 129 "bevy_auto_plugin_shared", ··· 133 133 134 134 [[package]] 135 135 name = "bevy_auto_plugin_proc_macros" 136 - version = "0.9.0" 136 + version = "0.10.0" 137 137 source = "registry+https://github.com/rust-lang/crates.io-index" 138 - checksum = "d85f2558b3a8f3d5e3e8df9debbff0665cad6c7c2bfde3537e7ff247fde3cd8f" 138 + checksum = "582998ec7135267343cdcfc441128b73bbc995be640e48e046e2a33f3ff5703f" 139 139 dependencies = [ 140 140 "bevy_auto_plugin_shared", 141 141 "proc-macro2", ··· 143 143 144 144 [[package]] 145 145 name = "bevy_auto_plugin_shared" 146 - version = "0.9.0" 146 + version = "0.10.0" 147 147 source = "registry+https://github.com/rust-lang/crates.io-index" 148 - checksum = "f6d825af42f08348a7c2307f50aabde362e774dd906c274556bd6b71794c8476" 148 + checksum = "999eb3756d075ac95e169f71333ac211e54e961ac55708a89731eb6134f38b7e" 149 149 dependencies = [ 150 150 "bevy_app", 151 - "darling 0.21.3", 151 + "darling", 152 152 "inventory", 153 153 "linkme", 154 154 "log", ··· 156 156 "proc-macro2", 157 157 "quote", 158 158 "smart-default", 159 - "syn 2.0.111", 160 - "thiserror 2.0.17", 159 + "syn 2.0.114", 160 + "thiserror 2.0.18", 161 161 ] 162 162 163 163 [[package]] ··· 168 168 dependencies = [ 169 169 "bevy_macro_utils", 170 170 "quote", 171 - "syn 2.0.111", 171 + "syn 2.0.114", 172 172 ] 173 173 174 174 [[package]] ··· 209 209 "nonmax", 210 210 "slotmap", 211 211 "smallvec", 212 - "thiserror 2.0.17", 212 + "thiserror 2.0.18", 213 213 "variadics_please", 214 214 ] 215 215 ··· 222 222 "bevy_macro_utils", 223 223 "proc-macro2", 224 224 "quote", 225 - "syn 2.0.111", 225 + "syn 2.0.114", 226 226 ] 227 227 228 228 [[package]] ··· 238 238 "bevy_reflect", 239 239 "derive_more", 240 240 "log", 241 - "thiserror 2.0.17", 241 + "thiserror 2.0.18", 242 242 ] 243 243 244 244 [[package]] ··· 271 271 dependencies = [ 272 272 "proc-macro2", 273 273 "quote", 274 - "syn 2.0.111", 274 + "syn 2.0.114", 275 275 "toml_edit", 276 276 ] 277 277 ··· 290 290 "rand", 291 291 "rand_distr", 292 292 "serde", 293 - "thiserror 2.0.17", 293 + "thiserror 2.0.18", 294 294 "variadics_please", 295 295 ] 296 296 ··· 335 335 "indexmap", 336 336 "serde", 337 337 "smallvec", 338 - "thiserror 2.0.17", 338 + "thiserror 2.0.18", 339 339 "variadics_please", 340 340 ] 341 341 ··· 349 349 "indexmap", 350 350 "proc-macro2", 351 351 "quote", 352 - "syn 2.0.111", 352 + "syn 2.0.114", 353 353 "uuid", 354 354 ] 355 355 ··· 396 396 "bevy_tasks", 397 397 "derive_more", 398 398 "serde", 399 - "thiserror 2.0.17", 399 + "thiserror 2.0.18", 400 400 ] 401 401 402 402 [[package]] ··· 423 423 424 424 [[package]] 425 425 name = "bytemuck" 426 - version = "1.24.0" 426 + version = "1.25.0" 427 427 source = "registry+https://github.com/rust-lang/crates.io-index" 428 - checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" 428 + checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" 429 429 dependencies = [ 430 430 "bytemuck_derive", 431 431 ] ··· 438 438 dependencies = [ 439 439 "proc-macro2", 440 440 "quote", 441 - "syn 2.0.111", 441 + "syn 2.0.114", 442 442 ] 443 443 444 444 [[package]] ··· 455 455 456 456 [[package]] 457 457 name = "cc" 458 - version = "1.2.50" 458 + version = "1.2.55" 459 459 source = "registry+https://github.com/rust-lang/crates.io-index" 460 - checksum = "9f50d563227a1c37cc0a263f64eca3334388c01c5e4c4861a9def205c614383c" 460 + checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29" 461 461 dependencies = [ 462 462 "find-msvc-tools", 463 463 "jobserver", ··· 539 539 source = "registry+https://github.com/rust-lang/crates.io-index" 540 540 checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" 541 541 dependencies = [ 542 - "darling_core 0.21.3", 543 - "darling_macro 0.21.3", 544 - ] 545 - 546 - [[package]] 547 - name = "darling" 548 - version = "0.23.0" 549 - source = "registry+https://github.com/rust-lang/crates.io-index" 550 - checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" 551 - dependencies = [ 552 - "darling_core 0.23.0", 553 - "darling_macro 0.23.0", 542 + "darling_core", 543 + "darling_macro", 554 544 ] 555 545 556 546 [[package]] ··· 564 554 "proc-macro2", 565 555 "quote", 566 556 "strsim", 567 - "syn 2.0.111", 568 - ] 569 - 570 - [[package]] 571 - name = "darling_core" 572 - version = "0.23.0" 573 - source = "registry+https://github.com/rust-lang/crates.io-index" 574 - checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" 575 - dependencies = [ 576 - "ident_case", 577 - "proc-macro2", 578 - "quote", 579 - "strsim", 580 - "syn 2.0.111", 557 + "syn 2.0.114", 581 558 ] 582 559 583 560 [[package]] ··· 586 563 source = "registry+https://github.com/rust-lang/crates.io-index" 587 564 checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" 588 565 dependencies = [ 589 - "darling_core 0.21.3", 566 + "darling_core", 590 567 "quote", 591 - "syn 2.0.111", 592 - ] 593 - 594 - [[package]] 595 - name = "darling_macro" 596 - version = "0.23.0" 597 - source = "registry+https://github.com/rust-lang/crates.io-index" 598 - checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" 599 - dependencies = [ 600 - "darling_core 0.23.0", 601 - "quote", 602 - "syn 2.0.111", 568 + "syn 2.0.114", 603 569 ] 604 570 605 571 [[package]] 606 572 name = "derive_more" 607 - version = "2.1.0" 573 + version = "2.1.1" 608 574 source = "registry+https://github.com/rust-lang/crates.io-index" 609 - checksum = "10b768e943bed7bf2cab53df09f4bc34bfd217cdb57d971e769874c9a6710618" 575 + checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" 610 576 dependencies = [ 611 577 "derive_more-impl", 612 578 ] 613 579 614 580 [[package]] 615 581 name = "derive_more-impl" 616 - version = "2.1.0" 582 + version = "2.1.1" 617 583 source = "registry+https://github.com/rust-lang/crates.io-index" 618 - checksum = "6d286bfdaf75e988b4a78e013ecd79c581e06399ab53fbacd2d916c2f904f30b" 584 + checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" 619 585 dependencies = [ 620 586 "convert_case", 621 587 "proc-macro2", 622 588 "quote", 623 589 "rustc_version", 624 - "syn 2.0.111", 590 + "syn 2.0.114", 625 591 "unicode-xid", 626 592 ] 627 593 ··· 682 648 683 649 [[package]] 684 650 name = "find-msvc-tools" 685 - version = "0.1.5" 651 + version = "0.1.9" 686 652 source = "registry+https://github.com/rust-lang/crates.io-index" 687 - checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" 653 + checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" 688 654 689 655 [[package]] 690 656 name = "fixedbitset" ··· 743 709 744 710 [[package]] 745 711 name = "glam" 746 - version = "0.30.9" 712 + version = "0.30.10" 747 713 source = "registry+https://github.com/rust-lang/crates.io-index" 748 - checksum = "bd47b05dddf0005d850e5644cae7f2b14ac3df487979dbfff3b56f20b1a6ae46" 714 + checksum = "19fc433e8437a212d1b6f1e68c7824af3aed907da60afa994e7f542d18d12aa9" 749 715 dependencies = [ 750 716 "bytemuck", 751 717 "libm", ··· 791 757 792 758 [[package]] 793 759 name = "immediate_stats" 794 - version = "0.4.0" 760 + version = "0.5.0" 795 761 dependencies = [ 796 762 "bevy", 797 763 "bevy_app", ··· 803 769 804 770 [[package]] 805 771 name = "immediate_stats_macros" 806 - version = "0.4.0" 772 + version = "0.5.0" 807 773 dependencies = [ 808 - "darling 0.23.0", 809 774 "proc-macro-error", 810 775 "proc-macro2", 811 776 "quote", 812 - "syn 2.0.111", 777 + "syn 2.0.114", 813 778 ] 814 779 815 780 [[package]] 816 781 name = "indexmap" 817 - version = "2.12.1" 782 + version = "2.13.0" 818 783 source = "registry+https://github.com/rust-lang/crates.io-index" 819 - checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" 784 + checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" 820 785 dependencies = [ 821 786 "equivalent", 822 787 "hashbrown", ··· 874 839 875 840 [[package]] 876 841 name = "js-sys" 877 - version = "0.3.83" 842 + version = "0.3.85" 878 843 source = "registry+https://github.com/rust-lang/crates.io-index" 879 - checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" 844 + checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" 880 845 dependencies = [ 881 846 "once_cell", 882 847 "wasm-bindgen", ··· 884 849 885 850 [[package]] 886 851 name = "libc" 887 - version = "0.2.178" 852 + version = "0.2.180" 888 853 source = "registry+https://github.com/rust-lang/crates.io-index" 889 - checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" 854 + checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" 890 855 891 856 [[package]] 892 857 name = "libm" 893 - version = "0.2.15" 858 + version = "0.2.16" 894 859 source = "registry+https://github.com/rust-lang/crates.io-index" 895 - checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" 860 + checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" 896 861 897 862 [[package]] 898 863 name = "linkme" ··· 911 876 dependencies = [ 912 877 "proc-macro2", 913 878 "quote", 914 - "syn 2.0.111", 879 + "syn 2.0.114", 915 880 ] 916 881 917 882 [[package]] ··· 922 887 923 888 [[package]] 924 889 name = "memchr" 925 - version = "2.7.6" 890 + version = "2.8.0" 926 891 source = "registry+https://github.com/rust-lang/crates.io-index" 927 - checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" 892 + checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" 928 893 929 894 [[package]] 930 895 name = "ndk" ··· 990 955 "proc-macro-crate", 991 956 "proc-macro2", 992 957 "quote", 993 - "syn 2.0.111", 958 + "syn 2.0.114", 994 959 ] 995 960 996 961 [[package]] ··· 1016 981 dependencies = [ 1017 982 "proc-macro2", 1018 983 "quote", 1019 - "syn 2.0.111", 984 + "syn 2.0.114", 1020 985 ] 1021 986 1022 987 [[package]] ··· 1027 992 1028 993 [[package]] 1029 994 name = "portable-atomic" 1030 - version = "1.12.0" 995 + version = "1.13.1" 1031 996 source = "registry+https://github.com/rust-lang/crates.io-index" 1032 - checksum = "f59e70c4aef1e55797c2e8fd94a4f2a973fc972cfde0e0b05f683667b0cd39dd" 997 + checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" 1033 998 1034 999 [[package]] 1035 1000 name = "portable-atomic-util" 1036 - version = "0.2.4" 1001 + version = "0.2.5" 1037 1002 source = "registry+https://github.com/rust-lang/crates.io-index" 1038 - checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" 1003 + checksum = "7a9db96d7fa8782dd8c15ce32ffe8680bbd1e978a43bf51a34d39483540495f5" 1039 1004 dependencies = [ 1040 1005 "portable-atomic", 1041 1006 ] ··· 1084 1049 1085 1050 [[package]] 1086 1051 name = "proc-macro2" 1087 - version = "1.0.103" 1052 + version = "1.0.106" 1088 1053 source = "registry+https://github.com/rust-lang/crates.io-index" 1089 - checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" 1054 + checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" 1090 1055 dependencies = [ 1091 1056 "unicode-ident", 1092 1057 ] 1093 1058 1094 1059 [[package]] 1095 1060 name = "quote" 1096 - version = "1.0.42" 1061 + version = "1.0.44" 1097 1062 source = "registry+https://github.com/rust-lang/crates.io-index" 1098 - checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" 1063 + checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" 1099 1064 dependencies = [ 1100 1065 "proc-macro2", 1101 1066 ] ··· 1128 1093 1129 1094 [[package]] 1130 1095 name = "rand_core" 1131 - version = "0.9.3" 1096 + version = "0.9.5" 1132 1097 source = "registry+https://github.com/rust-lang/crates.io-index" 1133 - checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" 1098 + checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" 1134 1099 dependencies = [ 1135 1100 "getrandom", 1136 1101 ] ··· 1202 1167 dependencies = [ 1203 1168 "proc-macro2", 1204 1169 "quote", 1205 - "syn 2.0.111", 1170 + "syn 2.0.114", 1206 1171 ] 1207 1172 1208 1173 [[package]] ··· 1234 1199 dependencies = [ 1235 1200 "proc-macro2", 1236 1201 "quote", 1237 - "syn 2.0.111", 1202 + "syn 2.0.114", 1238 1203 ] 1239 1204 1240 1205 [[package]] ··· 1270 1235 1271 1236 [[package]] 1272 1237 name = "syn" 1273 - version = "2.0.111" 1238 + version = "2.0.114" 1274 1239 source = "registry+https://github.com/rust-lang/crates.io-index" 1275 - checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" 1240 + checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" 1276 1241 dependencies = [ 1277 1242 "proc-macro2", 1278 1243 "quote", ··· 1290 1255 1291 1256 [[package]] 1292 1257 name = "thiserror" 1293 - version = "2.0.17" 1258 + version = "2.0.18" 1294 1259 source = "registry+https://github.com/rust-lang/crates.io-index" 1295 - checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" 1260 + checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" 1296 1261 dependencies = [ 1297 - "thiserror-impl 2.0.17", 1262 + "thiserror-impl 2.0.18", 1298 1263 ] 1299 1264 1300 1265 [[package]] ··· 1305 1270 dependencies = [ 1306 1271 "proc-macro2", 1307 1272 "quote", 1308 - "syn 2.0.111", 1273 + "syn 2.0.114", 1309 1274 ] 1310 1275 1311 1276 [[package]] 1312 1277 name = "thiserror-impl" 1313 - version = "2.0.17" 1278 + version = "2.0.18" 1314 1279 source = "registry+https://github.com/rust-lang/crates.io-index" 1315 - checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" 1280 + checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" 1316 1281 dependencies = [ 1317 1282 "proc-macro2", 1318 1283 "quote", 1319 - "syn 2.0.111", 1284 + "syn 2.0.114", 1320 1285 ] 1321 1286 1322 1287 [[package]] ··· 1375 1340 1376 1341 [[package]] 1377 1342 name = "uuid" 1378 - version = "1.19.0" 1343 + version = "1.20.0" 1379 1344 source = "registry+https://github.com/rust-lang/crates.io-index" 1380 - checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" 1345 + checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f" 1381 1346 dependencies = [ 1382 1347 "js-sys", 1383 1348 "wasm-bindgen", ··· 1391 1356 dependencies = [ 1392 1357 "proc-macro2", 1393 1358 "quote", 1394 - "syn 2.0.111", 1359 + "syn 2.0.114", 1395 1360 ] 1396 1361 1397 1362 [[package]] ··· 1412 1377 1413 1378 [[package]] 1414 1379 name = "wasip2" 1415 - version = "1.0.1+wasi-0.2.4" 1380 + version = "1.0.2+wasi-0.2.9" 1416 1381 source = "registry+https://github.com/rust-lang/crates.io-index" 1417 - checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" 1382 + checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" 1418 1383 dependencies = [ 1419 1384 "wit-bindgen", 1420 1385 ] 1421 1386 1422 1387 [[package]] 1423 1388 name = "wasm-bindgen" 1424 - version = "0.2.106" 1389 + version = "0.2.108" 1425 1390 source = "registry+https://github.com/rust-lang/crates.io-index" 1426 - checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" 1391 + checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" 1427 1392 dependencies = [ 1428 1393 "cfg-if", 1429 1394 "once_cell", ··· 1434 1399 1435 1400 [[package]] 1436 1401 name = "wasm-bindgen-macro" 1437 - version = "0.2.106" 1402 + version = "0.2.108" 1438 1403 source = "registry+https://github.com/rust-lang/crates.io-index" 1439 - checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" 1404 + checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" 1440 1405 dependencies = [ 1441 1406 "quote", 1442 1407 "wasm-bindgen-macro-support", ··· 1444 1409 1445 1410 [[package]] 1446 1411 name = "wasm-bindgen-macro-support" 1447 - version = "0.2.106" 1412 + version = "0.2.108" 1448 1413 source = "registry+https://github.com/rust-lang/crates.io-index" 1449 - checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" 1414 + checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" 1450 1415 dependencies = [ 1451 1416 "bumpalo", 1452 1417 "proc-macro2", 1453 1418 "quote", 1454 - "syn 2.0.111", 1419 + "syn 2.0.114", 1455 1420 "wasm-bindgen-shared", 1456 1421 ] 1457 1422 1458 1423 [[package]] 1459 1424 name = "wasm-bindgen-shared" 1460 - version = "0.2.106" 1425 + version = "0.2.108" 1461 1426 source = "registry+https://github.com/rust-lang/crates.io-index" 1462 - checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" 1427 + checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" 1463 1428 dependencies = [ 1464 1429 "unicode-ident", 1465 1430 ] ··· 1565 1530 1566 1531 [[package]] 1567 1532 name = "wit-bindgen" 1568 - version = "0.46.0" 1533 + version = "0.51.0" 1569 1534 source = "registry+https://github.com/rust-lang/crates.io-index" 1570 - checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" 1535 + checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" 1571 1536 1572 1537 [[package]] 1573 1538 name = "zerocopy" 1574 - version = "0.8.31" 1539 + version = "0.8.39" 1575 1540 source = "registry+https://github.com/rust-lang/crates.io-index" 1576 - checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" 1541 + checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" 1577 1542 dependencies = [ 1578 1543 "zerocopy-derive", 1579 1544 ] 1580 1545 1581 1546 [[package]] 1582 1547 name = "zerocopy-derive" 1583 - version = "0.8.31" 1548 + version = "0.8.39" 1584 1549 source = "registry+https://github.com/rust-lang/crates.io-index" 1585 - checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" 1550 + checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" 1586 1551 dependencies = [ 1587 1552 "proc-macro2", 1588 1553 "quote", 1589 - "syn 2.0.111", 1554 + "syn 2.0.114", 1590 1555 ]
+5 -9
README.md
··· 51 51 ### Bevy Auto Plugin 52 52 53 53 If you use [Bevy Auto Plugin](https://github.com/strikeforcezero/bevy_auto_plugin/), you can also use the `bevy_auto_plugin` feature flag. 54 - This automatically registers the required system(s) by leveraging the existing `auto_component` and `auto_resource` macros. 54 + This adds build hooks that automatically add the reset plugin. 55 55 56 56 ```rust 57 57 fn main() { ··· 62 62 #[auto_plugin(impl_plugin_trait)] 63 63 struct MyPlugin; 64 64 65 - // `StatContainer` derive hooks into the existing `auto_component` and `auto_resource` macros. 66 - #[derive(StatContainer, Component, Resource)] 67 - #[auto_component(plugin = MyPlugin)] // Adds `reset_component_modifiers` system. 68 - #[auto_init_resource(plugin = MyPlugin)] // Adds `reset_resource_modifiers` system. 65 + #[derive(StatContainer, Component)] 66 + // Use hook to add the `ResetComponentPlugin` to `MyPlugin` automatically. 67 + #[auto_plugin_build_hook(plugin = MyPlugin, hook = ResetComponentHook)] 69 68 struct Speed(Stat); 70 69 ``` 71 - 72 - It is important to note that this only works when the `derive` is above the `auto_*` macro, 73 - and does *not* work with `auto_bind_plugin`. 74 70 75 71 ### Version Compatibility 76 72 | Bevy | Immediate Stats | 77 73 |--------|-----------------| 78 74 | `0.18` | `0.4` | 79 75 | `0.17` | `0.3` | 80 - | `0.16` | `0.1` - `0.2` | 76 + | `0.16` | `0.1` - `0.2` |
+4 -8
immediate_stats/Cargo.toml
··· 1 1 [package] 2 2 name = "immediate_stats" 3 - version = "0.4.0" 3 + version = "0.5.0" 4 4 edition = "2024" 5 5 description = "Game stats that reset every frame, inspired by immediate mode GUI." 6 6 categories = ["game-development", "data-structures"] ··· 20 20 "dep:bevy_reflect", 21 21 "immediate_stats_macros/bevy", 22 22 ] 23 - bevy_auto_plugin = [ 24 - "bevy", 25 - "dep:bevy_auto_plugin", 26 - "immediate_stats_macros/bevy_auto_plugin", 27 - ] 23 + bevy_auto_plugin = ["bevy", "dep:bevy_auto_plugin"] 28 24 29 25 [dependencies] 30 26 bevy_app = { version = "0.18", default-features = false, optional = true, features = [ 31 27 "bevy_reflect", 32 28 ] } 33 - bevy_auto_plugin = { version = "0.9", optional = true } 29 + bevy_auto_plugin = { version = "0.10", optional = true } 34 30 bevy_ecs = { version = "0.18", default-features = false, optional = true, features = [ 35 31 "bevy_reflect", 36 32 ] } 37 33 bevy_reflect = { version = "0.18", default-features = false, optional = true } 38 - immediate_stats_macros = { path = "../immediate_stats_macros", version = "0.4.0", default-features = false } 34 + immediate_stats_macros = { path = "../immediate_stats_macros", version = "0.5.0", default-features = false } 39 35 40 36 [dev-dependencies] 41 37 bevy = { version = "0.18", default-features = false }
+3 -3
immediate_stats/examples/simple_bevy_auto_plugin.rs
··· 3 3 4 4 use bevy::prelude::*; 5 5 use bevy_auto_plugin; 6 - use bevy_auto_plugin::prelude::{AutoPlugin, auto_component, auto_system}; 6 + use bevy_auto_plugin::prelude::{AutoPlugin, auto_plugin_build_hook, auto_system}; 7 7 use immediate_stats::*; 8 8 9 9 fn main() { ··· 17 17 struct SpeedPlugin; 18 18 19 19 // Implements `reset_modifiers` by passing the call onto `Stat`. 20 - // This will also add the `ResetComponentPlugin` to `SpeedPlugin`. 21 20 #[derive(StatContainer, Component)] 22 - #[auto_component(plugin = SpeedPlugin)] 21 + // Use hook to add the `ResetComponentPlugin` to `SpeedPlugin` automatically. 22 + #[auto_plugin_build_hook(plugin = SpeedPlugin, hook = ResetComponentHook)] 23 23 struct Speed(Stat); 24 24 25 25 #[auto_system(plugin = SpeedPlugin, schedule = Startup)]
+6
immediate_stats/src/bevy.rs
··· 1 1 #![cfg(feature = "bevy")] 2 2 //! Contains systems and components for resetting [`StatContainer`]s in the Bevy game engine. 3 3 4 + #[cfg(feature = "bevy_auto_plugin")] 5 + mod auto_plugin; 6 + 4 7 use crate::StatContainer; 5 8 use crate::modifier::Modifier; 6 9 use crate::stat::Stat; ··· 11 14 use bevy_reflect::Reflect; 12 15 use bevy_reflect::prelude::ReflectDefault; 13 16 use std::marker::PhantomData; 17 + 18 + #[cfg(feature = "bevy_auto_plugin")] 19 + pub use auto_plugin::*; 14 20 15 21 /// Configures [system ordering](StatSystems) and registers types with the Bevy type registry. 16 22 ///
+28
immediate_stats/src/bevy/auto_plugin.rs
··· 1 + #![cfg(feature = "bevy_auto_plugin")] 2 + //! Contains a hook for resetting [`StatContainer`]s using Bevy Auto Plugin. 3 + 4 + use crate::{ResetComponentPlugin, ResetResourcePlugin, StatContainer}; 5 + use bevy_app::App; 6 + use bevy_auto_plugin::prelude::AutoPluginBuildHook; 7 + use bevy_ecs::component::Mutable; 8 + use bevy_ecs::prelude::{Component, Resource}; 9 + 10 + /// A Bevy Auto Plugin hook that adds the [`ResetComponentPlugin`] for the component. 11 + pub struct ResetComponentHook; 12 + 13 + impl<T: Component<Mutability = Mutable> + StatContainer + 'static> AutoPluginBuildHook<T> 14 + for ResetComponentHook 15 + { 16 + fn on_build(&self, app: &mut App) { 17 + app.add_plugins(ResetComponentPlugin::<T>::new()); 18 + } 19 + } 20 + 21 + /// A Bevy Auto Plugin hook that adds the [`ResetResourcePlugin`] for the resource. 22 + pub struct ResetResourceHook; 23 + 24 + impl<T: Resource + StatContainer + 'static> AutoPluginBuildHook<T> for ResetResourceHook { 25 + fn on_build(&self, app: &mut App) { 26 + app.add_plugins(ResetResourcePlugin::<T>::new()); 27 + } 28 + }
+8 -31
immediate_stats/src/lib.rs
··· 50 50 //! 51 51 //! ### Bevy Auto Plugin 52 52 //! 53 - //! If you use [Bevy Auto Plugin](https://github.com/strikeforcezero/bevy_auto_plugin/), 54 - //! you can also use the `bevy_auto_plugin` feature flag. This automatically registers the required 55 - //! system(s) by leveraging the existing `auto_component` and `auto_resource` macros. 53 + //! If you use [Bevy Auto Plugin](https://github.com/strikeforcezero/bevy_auto_plugin/), you can also use the `bevy_auto_plugin` feature flag. 54 + //! This adds build hooks that automatically add the reset plugin. 56 55 //! 57 56 #![cfg_attr(not(feature = "bevy_auto_plugin"), doc = "```rust ignore")] 58 57 #![cfg_attr(feature = "bevy_auto_plugin", doc = "```rust")] 59 58 //! # use bevy_app::prelude::*; 60 59 //! # use bevy_ecs::prelude::*; 61 60 //! # use immediate_stats::*; 62 - //! # use bevy_auto_plugin::prelude::{AutoPlugin, auto_component, auto_resource}; 61 + //! # use bevy_auto_plugin::prelude::{AutoPlugin, auto_plugin_build_hook, auto_resource}; 62 + //! 63 63 //! fn main() { 64 64 //! App::new().add_plugins((ImmediateStatsPlugin, MyPlugin)).run(); 65 65 //! } ··· 68 68 //! #[auto_plugin(impl_plugin_trait)] 69 69 //! struct MyPlugin; 70 70 //! 71 - //! // `StatContainer` derive hooks into the existing `auto_component` and `auto_resource` macros. 72 - //! #[derive(StatContainer, Component, Resource)] 73 - //! #[auto_component(plugin = MyPlugin)] // Adds `reset_component_modifiers` system. 74 - //! #[auto_resource(plugin = MyPlugin)] // Adds `reset_resource_modifiers` system. 71 + //! #[derive(StatContainer, Component)] 72 + //! // Use hook to add the `ResetComponentPlugin` to `MyPlugin` automatically. 73 + //! #[auto_plugin_build_hook(plugin = MyPlugin, hook = ResetComponentHook)] 75 74 //! struct Speed(Stat); 76 75 //! ``` 77 76 //! 78 - //! It is important to note that this only works when the `derive` is above the `auto_*` macro, 79 - //! and does *not* work with `auto_bind_plugin`. 80 - //! 81 77 //! ### Version Compatibility 82 78 //! | Bevy | Immediate Stats | 83 79 //! |--------|-----------------| 80 + //! | `0.18` | `0.4` | 84 81 //! | `0.17` | `0.3` | 85 82 //! | `0.16` | `0.1` - `0.2` | 86 83 ··· 143 140 /// assert_eq!(partial.custom, Health::default()); 144 141 /// assert_eq!(partial.ignored, Stat::default().with_bonus(10)); 145 142 /// } 146 - /// ``` 147 - /// # Bevy Auto Plugin 148 - /// If the `bevy_auto_plugin` feature flag is enabled, the existing `auto_component` and 149 - /// `auto_resource` macros will register [`reset_component_modifiers`] and/or 150 - /// [`reset_resource_modifiers`] automatically. 151 - #[cfg_attr(not(feature = "bevy_auto_plugin"), doc = "```rust ignore")] 152 - #[cfg_attr(feature = "bevy_auto_plugin", doc = "```rust")] 153 - /// # use bevy_app::prelude::*; 154 - /// # use bevy_ecs::prelude::*; 155 - /// # use immediate_stats::*; 156 - /// # use bevy_auto_plugin::prelude::{AutoPlugin, auto_component, auto_resource}; 157 - /// #[derive(AutoPlugin)] 158 - /// #[auto_plugin(impl_plugin_trait)] 159 - /// struct MyPlugin; 160 - /// 161 - /// // `StatContainer` derive hooks into the existing `auto_component` and `auto_resource` macros. 162 - /// #[derive(StatContainer, Component, Resource)] 163 - /// #[auto_component(plugin = MyPlugin)] // Adds `reset_component_modifiers` system. 164 - /// #[auto_resource(plugin = MyPlugin)] // Adds `reset_resource_modifiers` system. 165 - /// struct Speed(Stat); 166 143 /// ``` 167 144 pub use immediate_stats_macros::StatContainer; 168 145 pub use modifier::*;
+9 -4
immediate_stats/tests/bevy_auto_plugin.rs
··· 1 - //! Tests the `add_component` attribute for automatic system registration. 1 + //! Tests the `ResetComponentHook` and `ResetResourceHook`. 2 2 #![cfg(feature = "bevy_auto_plugin")] 3 3 4 4 extern crate immediate_stats; 5 5 use crate::{Stat, StatContainer}; 6 6 use bevy_app::App; 7 - use bevy_auto_plugin::prelude::{AutoPlugin, auto_component, auto_init_resource}; 7 + use bevy_auto_plugin::prelude::{ 8 + AutoPlugin, auto_bind_plugin, auto_component, auto_plugin_build_hook, auto_resource, 9 + }; 8 10 use bevy_ecs::prelude::*; 9 11 use immediate_stats::*; 10 12 ··· 13 15 struct MyPlugin; 14 16 15 17 #[derive(Resource, Component, StatContainer, Default, PartialEq, Debug)] 16 - #[auto_component(plugin = MyPlugin)] 17 - #[auto_init_resource(plugin = MyPlugin)] 18 + #[auto_bind_plugin(plugin = MyPlugin)] 19 + #[auto_plugin_build_hook(hook = ResetComponentHook)] 20 + #[auto_plugin_build_hook(hook = ResetResourceHook)] 21 + #[auto_component()] 22 + #[auto_resource(init)] 18 23 struct Health(Stat); 19 24 20 25 #[test]
+1 -3
immediate_stats_macros/Cargo.toml
··· 1 1 [package] 2 2 name = "immediate_stats_macros" 3 - version = "0.4.0" 3 + version = "0.5.0" 4 4 edition = "2024" 5 5 description = "Game stats that reset every frame, inspired by immediate mode GUI." 6 6 categories = ["game-development", "data-structures"] ··· 18 18 19 19 [features] 20 20 bevy = [] 21 - bevy_auto_plugin = ["bevy"] 22 21 23 22 [dependencies] 24 - darling = "0.23" 25 23 proc-macro2 = "1.0" 26 24 proc-macro-error = "1.0" 27 25 quote = "1.0"
-130
immediate_stats_macros/src/bevy_auto_plugin.rs
··· 1 - use darling::ast::NestedMeta; 2 - use darling::{Error, FromMeta}; 3 - use proc_macro2::{Ident, TokenStream}; 4 - use quote::{ToTokens, format_ident, quote}; 5 - use syn::{DeriveInput, Expr, Meta, Path}; 6 - 7 - /// Returns code that will register stat resetting system(s) with Bevy Auto Plugin. 8 - pub fn register_systems(input: &DeriveInput) -> darling::Result<TokenStream> { 9 - let struct_name = &input.ident; 10 - 11 - let mut auto_plugin_attributes = AutoPluginAttributes::new(struct_name); 12 - 13 - for attr in &input.attrs { 14 - if attr.path().is_ident("auto_component") { 15 - let plugin = PluginPath::from_meta(&attr.meta)?; 16 - auto_plugin_attributes.component_plugin = Some(plugin); 17 - } else if attr.path().is_ident("auto_resource") 18 - || attr.path().is_ident("auto_init_resource") 19 - || attr.path().is_ident("auto_insert_resource") 20 - { 21 - let plugin = PluginPath::from_meta(&attr.meta)?; 22 - auto_plugin_attributes.resource_plugin = Some(plugin); 23 - } 24 - } 25 - 26 - Ok(auto_plugin_attributes.into_token_stream()) 27 - } 28 - 29 - pub struct AutoPluginAttributes<'a> { 30 - ident: &'a Ident, 31 - component_plugin: Option<PluginPath>, 32 - resource_plugin: Option<PluginPath>, 33 - } 34 - 35 - impl<'a> AutoPluginAttributes<'a> { 36 - pub fn new(ident: &'a Ident) -> Self { 37 - Self { 38 - ident, 39 - component_plugin: None, 40 - resource_plugin: None, 41 - } 42 - } 43 - } 44 - 45 - impl<'a> ToTokens for AutoPluginAttributes<'a> { 46 - fn to_tokens(&self, tokens: &mut TokenStream) { 47 - if let Some(plugin_path) = &self.component_plugin { 48 - let ident = &self.ident; 49 - let plugin = &plugin_path.0; 50 - let system_ident = format_ident!("__reset_{ident}_component_modifiers"); 51 - 52 - tokens.extend(quote! { 53 - #[bevy_auto_plugin::prelude::auto_system( 54 - plugin = #plugin, 55 - schedule = immediate_stats::__PreUpdate, 56 - config( 57 - in_set = immediate_stats::StatSystems::Reset, 58 - ) 59 - )] 60 - fn #system_ident( 61 - mut query: Query<&mut #ident, Without<immediate_stats::PauseStatReset>>, 62 - ) { 63 - for mut stat in &mut query { 64 - stat.reset_modifiers(); 65 - } 66 - } 67 - }); 68 - } 69 - 70 - if let Some(plugin_path) = &self.resource_plugin { 71 - let ident = &self.ident; 72 - let plugin = &plugin_path.0; 73 - let system_ident = format_ident!("__reset_{ident}_resource_modifiers"); 74 - 75 - tokens.extend(quote! { 76 - #[bevy_auto_plugin::prelude::auto_system( 77 - plugin = #plugin, 78 - schedule = immediate_stats::__PreUpdate, 79 - config( 80 - in_set = immediate_stats::StatSystems::Reset, 81 - ) 82 - )] 83 - fn #system_ident(res: Option<ResMut<#ident>>) { 84 - if let Some(mut res) = res { 85 - res.reset_modifiers(); 86 - } 87 - } 88 - }); 89 - } 90 - } 91 - } 92 - 93 - /// Represents a `plugin(PATH)` or `plugin = PATH` attribute meta. 94 - pub struct PluginPath(pub Path); 95 - 96 - impl FromMeta for PluginPath { 97 - fn from_list(items: &[NestedMeta]) -> darling::Result<Self> { 98 - for item in items { 99 - return match item { 100 - NestedMeta::Meta(meta) => match meta { 101 - Meta::Path(_) => Err(Error::custom("Expected a value for `plugin`")), 102 - Meta::List(list) => { 103 - if list.path.require_ident()? != "plugin" { 104 - continue; 105 - } 106 - 107 - let mut path = None; 108 - 109 - list.parse_nested_meta(|value_meta| { 110 - path = Some(value_meta.path); 111 - Ok(()) 112 - })?; 113 - 114 - match path { 115 - None => Err(Error::custom("Expected `plugin` attribute")), 116 - Some(path) => Ok(PluginPath(path)), 117 - } 118 - } 119 - Meta::NameValue(name_value) => match &name_value.value { 120 - Expr::Path(p) => Ok(PluginPath(p.path.clone())), 121 - _ => Err(Error::custom("Expected a path to an auto plugin")), 122 - }, 123 - }, 124 - NestedMeta::Lit(_) => Err(Error::custom("Expected `plugin` attribute")), 125 - }; 126 - } 127 - 128 - Err(Error::custom("Expected `plugin` attribute")) 129 - } 130 - }
-10
immediate_stats_macros/src/lib.rs
··· 1 - #[cfg(feature = "bevy_auto_plugin")] 2 - mod bevy_auto_plugin; 3 1 mod derive_enum; 4 2 mod derive_struct; 5 3 ··· 31 29 } 32 30 }; 33 31 34 - #[cfg(feature = "bevy_auto_plugin")] 35 - { 36 - let systems = 37 - bevy_auto_plugin::register_systems(&tree).unwrap_or_else(darling::Error::write_errors); 38 - quote! { #trait_impl #systems }.into() 39 - } 40 - 41 - #[cfg(not(feature = "bevy_auto_plugin"))] 42 32 trait_impl.into() 43 33 } 44 34