gdritter repos wenaglia / 6cfed23
Switch to using specs ECS for the stuff Getty Ritter 5 years ago
3 changed file(s) with 509 addition(s) and 80 deletion(s). Collapse all Expand all
6363 dependencies = [
6464 "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
6565 ]
66
67 [[package]]
68 name = "atom"
69 version = "0.3.5"
70 source = "registry+https://github.com/rust-lang/crates.io-index"
6671
6772 [[package]]
6873 name = "atty"
292297 ]
293298
294299 [[package]]
300 name = "crossbeam"
301 version = "0.4.1"
302 source = "registry+https://github.com/rust-lang/crates.io-index"
303 dependencies = [
304 "crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
305 "crossbeam-deque 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
306 "crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
307 "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
308 ]
309
310 [[package]]
311 name = "crossbeam-channel"
312 version = "0.2.6"
313 source = "registry+https://github.com/rust-lang/crates.io-index"
314 dependencies = [
315 "crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
316 "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
317 "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
318 "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
319 "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
320 ]
321
322 [[package]]
323 name = "crossbeam-deque"
324 version = "0.2.0"
325 source = "registry+https://github.com/rust-lang/crates.io-index"
326 dependencies = [
327 "crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
328 "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
329 ]
330
331 [[package]]
332 name = "crossbeam-deque"
333 version = "0.5.2"
334 source = "registry+https://github.com/rust-lang/crates.io-index"
335 dependencies = [
336 "crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
337 "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
338 ]
339
340 [[package]]
341 name = "crossbeam-epoch"
342 version = "0.3.1"
343 source = "registry+https://github.com/rust-lang/crates.io-index"
344 dependencies = [
345 "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
346 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
347 "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
348 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
349 "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
350 "nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
351 "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
352 ]
353
354 [[package]]
355 name = "crossbeam-epoch"
356 version = "0.5.2"
357 source = "registry+https://github.com/rust-lang/crates.io-index"
358 dependencies = [
359 "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
360 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
361 "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
362 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
363 "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
364 "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
365 ]
366
367 [[package]]
368 name = "crossbeam-epoch"
369 version = "0.6.1"
370 source = "registry+https://github.com/rust-lang/crates.io-index"
371 dependencies = [
372 "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
373 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
374 "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
375 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
376 "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
377 "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
378 ]
379
380 [[package]]
381 name = "crossbeam-utils"
382 version = "0.2.2"
383 source = "registry+https://github.com/rust-lang/crates.io-index"
384 dependencies = [
385 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
386 ]
387
388 [[package]]
389 name = "crossbeam-utils"
390 version = "0.5.0"
391 source = "registry+https://github.com/rust-lang/crates.io-index"
392
393 [[package]]
394 name = "crossbeam-utils"
395 version = "0.6.5"
396 source = "registry+https://github.com/rust-lang/crates.io-index"
397 dependencies = [
398 "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
399 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
400 ]
401
402 [[package]]
295403 name = "deflate"
296404 version = "0.7.19"
297405 source = "registry+https://github.com/rust-lang/crates.io-index"
360468 name = "fuchsia-cprng"
361469 version = "0.1.1"
362470 source = "registry+https://github.com/rust-lang/crates.io-index"
471
472 [[package]]
473 name = "fxhash"
474 version = "0.2.1"
475 source = "registry+https://github.com/rust-lang/crates.io-index"
476 dependencies = [
477 "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
478 ]
363479
364480 [[package]]
365481 name = "generic-array"
487603 source = "registry+https://github.com/rust-lang/crates.io-index"
488604
489605 [[package]]
606 name = "hibitset"
607 version = "0.5.4"
608 source = "registry+https://github.com/rust-lang/crates.io-index"
609 dependencies = [
610 "atom 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
611 "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
612 ]
613
614 [[package]]
490615 name = "hound"
491616 version = "3.4.0"
492617 source = "registry+https://github.com/rust-lang/crates.io-index"
529654 dependencies = [
530655 "ggez 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
531656 "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
657 "specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
658 "specs-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
532659 "tiled 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
533660 ]
534661
594721 source = "registry+https://github.com/rust-lang/crates.io-index"
595722
596723 [[package]]
724 name = "lock_api"
725 version = "0.1.5"
726 source = "registry+https://github.com/rust-lang/crates.io-index"
727 dependencies = [
728 "owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
729 "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
730 ]
731
732 [[package]]
597733 name = "log"
598734 version = "0.3.9"
599735 source = "registry+https://github.com/rust-lang/crates.io-index"
671807 source = "registry+https://github.com/rust-lang/crates.io-index"
672808
673809 [[package]]
810 name = "memoffset"
811 version = "0.2.1"
812 source = "registry+https://github.com/rust-lang/crates.io-index"
813
814 [[package]]
674815 name = "miniz-sys"
675816 version = "0.1.11"
676817 source = "registry+https://github.com/rust-lang/crates.io-index"
697838 "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
698839 "miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
699840 ]
841
842 [[package]]
843 name = "mopa"
844 version = "0.2.2"
845 source = "registry+https://github.com/rust-lang/crates.io-index"
700846
701847 [[package]]
702848 name = "msdos_time"
736882 ]
737883
738884 [[package]]
885 name = "nonzero_signed"
886 version = "1.0.3"
887 source = "registry+https://github.com/rust-lang/crates.io-index"
888
889 [[package]]
739890 name = "num"
740891 version = "0.1.42"
741892 source = "registry+https://github.com/rust-lang/crates.io-index"
803954 source = "registry+https://github.com/rust-lang/crates.io-index"
804955
805956 [[package]]
957 name = "num_cpus"
958 version = "1.10.0"
959 source = "registry+https://github.com/rust-lang/crates.io-index"
960 dependencies = [
961 "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
962 ]
963
964 [[package]]
806965 name = "ogg"
807966 version = "0.4.1"
808967 source = "registry+https://github.com/rust-lang/crates.io-index"
826985 dependencies = [
827986 "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
828987 "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
988 ]
989
990 [[package]]
991 name = "owning_ref"
992 version = "0.3.3"
993 source = "registry+https://github.com/rust-lang/crates.io-index"
994 dependencies = [
995 "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
996 ]
997
998 [[package]]
999 name = "owning_ref"
1000 version = "0.4.0"
1001 source = "registry+https://github.com/rust-lang/crates.io-index"
1002 dependencies = [
1003 "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
1004 ]
1005
1006 [[package]]
1007 name = "parking_lot"
1008 version = "0.5.5"
1009 source = "registry+https://github.com/rust-lang/crates.io-index"
1010 dependencies = [
1011 "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
1012 "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
1013 ]
1014
1015 [[package]]
1016 name = "parking_lot"
1017 version = "0.6.4"
1018 source = "registry+https://github.com/rust-lang/crates.io-index"
1019 dependencies = [
1020 "lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
1021 "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
1022 ]
1023
1024 [[package]]
1025 name = "parking_lot_core"
1026 version = "0.2.14"
1027 source = "registry+https://github.com/rust-lang/crates.io-index"
1028 dependencies = [
1029 "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
1030 "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
1031 "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
1032 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
1033 ]
1034
1035 [[package]]
1036 name = "parking_lot_core"
1037 version = "0.3.1"
1038 source = "registry+https://github.com/rust-lang/crates.io-index"
1039 dependencies = [
1040 "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
1041 "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
1042 "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
1043 "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
1044 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
8291045 ]
8301046
8311047 [[package]]
9091125 "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
9101126 "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
9111127 "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
1128 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
1129 ]
1130
1131 [[package]]
1132 name = "rand"
1133 version = "0.5.6"
1134 source = "registry+https://github.com/rust-lang/crates.io-index"
1135 dependencies = [
1136 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
1137 "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
1138 "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
1139 "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
9121140 "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
9131141 ]
9141142
10141242 source = "registry+https://github.com/rust-lang/crates.io-index"
10151243
10161244 [[package]]
1245 name = "rayon"
1246 version = "1.0.3"
1247 source = "registry+https://github.com/rust-lang/crates.io-index"
1248 dependencies = [
1249 "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
1250 "either 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1251 "rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
1252 ]
1253
1254 [[package]]
1255 name = "rayon-core"
1256 version = "1.4.1"
1257 source = "registry+https://github.com/rust-lang/crates.io-index"
1258 dependencies = [
1259 "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
1260 "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
1261 "libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)",
1262 "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
1263 ]
1264
1265 [[package]]
10171266 name = "rdrand"
10181267 version = "0.4.0"
10191268 source = "registry+https://github.com/rust-lang/crates.io-index"
10731322 source = "registry+https://github.com/rust-lang/crates.io-index"
10741323
10751324 [[package]]
1325 name = "rustc_version"
1326 version = "0.2.3"
1327 source = "registry+https://github.com/rust-lang/crates.io-index"
1328 dependencies = [
1329 "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
1330 ]
1331
1332 [[package]]
10761333 name = "rusttype"
10771334 version = "0.5.2"
10781335 source = "registry+https://github.com/rust-lang/crates.io-index"
10861343 ]
10871344
10881345 [[package]]
1346 name = "scopeguard"
1347 version = "0.3.3"
1348 source = "registry+https://github.com/rust-lang/crates.io-index"
1349
1350 [[package]]
10891351 name = "sdl2"
10901352 version = "0.31.0"
10911353 source = "registry+https://github.com/rust-lang/crates.io-index"
11071369 ]
11081370
11091371 [[package]]
1372 name = "semver"
1373 version = "0.9.0"
1374 source = "registry+https://github.com/rust-lang/crates.io-index"
1375 dependencies = [
1376 "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
1377 ]
1378
1379 [[package]]
1380 name = "semver-parser"
1381 version = "0.7.0"
1382 source = "registry+https://github.com/rust-lang/crates.io-index"
1383
1384 [[package]]
11101385 name = "serde"
11111386 version = "1.0.89"
11121387 source = "registry+https://github.com/rust-lang/crates.io-index"
11311406 ]
11321407
11331408 [[package]]
1409 name = "shred"
1410 version = "0.7.1"
1411 source = "registry+https://github.com/rust-lang/crates.io-index"
1412 dependencies = [
1413 "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
1414 "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
1415 "mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
1416 "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
1417 "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
1418 ]
1419
1420 [[package]]
1421 name = "shred-derive"
1422 version = "0.5.1"
1423 source = "registry+https://github.com/rust-lang/crates.io-index"
1424 dependencies = [
1425 "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
1426 "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
1427 "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)",
1428 ]
1429
1430 [[package]]
1431 name = "shrev"
1432 version = "1.0.1"
1433 source = "registry+https://github.com/rust-lang/crates.io-index"
1434 dependencies = [
1435 "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1436 "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
1437 ]
1438
1439 [[package]]
11341440 name = "sid"
11351441 version = "0.5.2"
11361442 source = "registry+https://github.com/rust-lang/crates.io-index"
11511457 "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
11521458 "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
11531459 ]
1460
1461 [[package]]
1462 name = "specs"
1463 version = "0.14.3"
1464 source = "registry+https://github.com/rust-lang/crates.io-index"
1465 dependencies = [
1466 "crossbeam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
1467 "derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1468 "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
1469 "hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
1470 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
1471 "mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
1472 "nonzero_signed 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
1473 "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
1474 "shred 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
1475 "shred-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
1476 "shrev 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
1477 "tuple_utils 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
1478 ]
1479
1480 [[package]]
1481 name = "specs-derive"
1482 version = "0.4.0"
1483 source = "registry+https://github.com/rust-lang/crates.io-index"
1484 dependencies = [
1485 "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)",
1486 "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)",
1487 "syn 0.15.29 (registry+https://github.com/rust-lang/crates.io-index)",
1488 ]
1489
1490 [[package]]
1491 name = "stable_deref_trait"
1492 version = "1.1.1"
1493 source = "registry+https://github.com/rust-lang/crates.io-index"
11541494
11551495 [[package]]
11561496 name = "stb_truetype"
12511591 dependencies = [
12521592 "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)",
12531593 ]
1594
1595 [[package]]
1596 name = "tuple_utils"
1597 version = "0.2.0"
1598 source = "registry+https://github.com/rust-lang/crates.io-index"
12541599
12551600 [[package]]
12561601 name = "twox-hash"
13991744 "checksum app_dirs2 2.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0aa02944d8a100b79057d1619032b1ad39de5eed6567cdeccbd53908b326e082"
14001745 "checksum approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08abcc3b4e9339e33a3d0a5ed15d84a687350c05689d825e0f6655eef9e76a94"
14011746 "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
1747 "checksum atom 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3c86699c3f02778ec07158376991c8f783dd1f2f95c579ffaf0738dc984b2fe2"
14021748 "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
14031749 "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"
14041750 "checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4"
14261772 "checksum cpal 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d58ae1ed6536b1b233f5e3aeb6997a046ddb4d05e3f61701b58a92eb254a829e"
14271773 "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
14281774 "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
1775 "checksum crossbeam 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d7408247b1b87f480890f28b670c5f8d9a8a4274833433fe74dc0dfd46d33650"
1776 "checksum crossbeam-channel 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7b85741761b7f160bc5e7e0c14986ef685b7f8bf9b7ad081c60c604bb4649827"
1777 "checksum crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f739f8c5363aca78cfb059edf753d8f0d36908c348f3d8d1503f03d8b75d9cf3"
1778 "checksum crossbeam-deque 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7792c4a9b5a4222f654e3728a3dd945aacc24d2c3a1a096ed265d80e4929cb9a"
1779 "checksum crossbeam-epoch 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "927121f5407de9956180ff5e936fe3cf4324279280001cd56b669d28ee7e9150"
1780 "checksum crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30fecfcac6abfef8771151f8be4abc9e4edc112c2bcb233314cafde2680536e9"
1781 "checksum crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2449aaa4ec7ef96e5fb24db16024b935df718e9ae1cec0a1e68feeca2efca7b8"
1782 "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
1783 "checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015"
1784 "checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c"
14291785 "checksum deflate 0.7.19 (registry+https://github.com/rust-lang/crates.io-index)" = "8a6abb26e16e8d419b5c78662aa9f82857c2386a073da266840e474d5055ec86"
14301786 "checksum derivative 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6073e9676dbebdddeabaeb63e3b7cefd23c86f5c41d381ee1237cc77b1079898"
14311787 "checksum draw_state 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "33cf9537e2d06891448799b96d5a8c8083e0e90522a7fdabe6ebf4f41d79d651"
14351791 "checksum flate2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2291c165c8e703ee54ef3055ad6188e3d51108e2ded18e9f2476e774fc5ad3d4"
14361792 "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
14371793 "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
1794 "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
14381795 "checksum generic-array 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fceb69994e330afed50c93524be68c42fa898c2d9fd4ee8da03bd7363acd26f2"
14391796 "checksum gfx 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7d7ce0c1f747245342a73453fdb098ea0764c430421fbc4d98cdc8ef8ede4834"
14401797 "checksum gfx_core 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c74932837e61f20956c3da1a47471513707dde300274812bba94373ab51830ae"
14461803 "checksum gif 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4bca55ac1f213920ce3527ccd62386f1f15fa3f1714aeee1cf93f2c416903f"
14471804 "checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"
14481805 "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
1806 "checksum hibitset 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6527bc88f32e0d3926c7572874b2bf17a19b36978aacd0aacf75f7d27a5992d0"
14491807 "checksum hound 3.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a164bb2ceaeff4f42542bdb847c41517c78a60f5649671b2a07312b6e117549"
14501808 "checksum image 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebdff791af04e30089bde8ad2a632b86af433b40c04db8d70ad4b21487db7a6a"
14511809 "checksum inflate 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1cdb29978cc5797bd8dcc8e5bf7de604891df2a8dc576973d71a281e916db2ff"
14591817 "checksum libc 0.2.50 (registry+https://github.com/rust-lang/crates.io-index)" = "aab692d7759f5cd8c859e169db98ae5b52c924add2af5fbbca11d12fefb567c1"
14601818 "checksum libloading 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fd38073de8f7965d0c17d30546d4bb6da311ab428d1c7a3fc71dff7f9d4979b9"
14611819 "checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
1820 "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
14621821 "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
14631822 "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
14641823 "checksum lyon 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "aefaafb69dc360deaeb1a645b11eedd25b45047dd46d5adb5775349e051e7a6c"
14691828 "checksum matrixmultiply 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "dcad67dcec2d58ff56f6292582377e6921afdf3bfbd533e26fb8900ae575e002"
14701829 "checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
14711830 "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
1831 "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
14721832 "checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649"
14731833 "checksum miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c468f2369f07d651a5d0bb2c9079f8488a66d5466efe42d0c5c6466edcb7f71e"
14741834 "checksum miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fe927a42e3807ef71defb191dc87d4e24479b221e67015fe38ae2b7b447bab"
1835 "checksum mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a785740271256c230f57462d3b83e52f998433a7062fc18f96d5999474a9f915"
14751836 "checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729"
14761837 "checksum nalgebra 0.14.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3f73409a1a0876d9d7be16a7fb8fd7e0658df54098210c93a17d2d5e8ca7afe4"
14771838 "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
14781839 "checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b"
1840 "checksum nonzero_signed 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "02783a0482333b0d3f5f5411b8fb60454a596696da041da0470ac9ef3e6e37d8"
14791841 "checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e"
14801842 "checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656"
14811843 "checksum num-derive 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d9fe8fcafd1b86a37ce8a1cfa15ae504817e0c8c2e7ad42767371461ac1d316d"
14841846 "checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e"
14851847 "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31"
14861848 "checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
1849 "checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba"
14871850 "checksum ogg 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "013b78ceb7fb82555a2f8a95d8e40866fe64a5d15b83c51b3e1fdd40cd903ed3"
14881851 "checksum ole32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2c49021782e5233cd243168edfa8037574afed4eba4bbaf538b3d8d1789d8c"
14891852 "checksum ordered-float 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7eb5259643245d3f292c7a146b2df53bba24d7eab159410e648eb73dc164669d"
1853 "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
1854 "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
1855 "checksum parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4d05f1349491390b1730afba60bb20d55761bef489a954546b58b4b34e1e2ac"
1856 "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
1857 "checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
1858 "checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c"
14901859 "checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
14911860 "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
14921861 "checksum png 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f54b9600d584d3b8a739e1662a595fab051329eff43f20e7d8cc22872962145b"
14981867 "checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1"
14991868 "checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
15001869 "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
1870 "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9"
15011871 "checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
15021872 "checksum rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
15031873 "checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
15091879 "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
15101880 "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
15111881 "checksum rawpointer 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebac11a9d2e11f2af219b8b8d833b76b1ea0e054aa0e8d8e9e4cbde353bdf019"
1882 "checksum rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "373814f27745b2686b350dd261bfd24576a6fb0e2c5919b3a2b6005f820b0473"
1883 "checksum rayon-core 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b055d1e92aba6877574d8fe604a63c8b5df60f60e5982bf7ccbb1338ea527356"
15121884 "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
15131885 "checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85"
15141886 "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
15161888 "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7"
15171889 "checksum rodio 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1e2767a246f9b284ec568e45e17ed3e6c52a91a3d42fa11ba00466b6ea5a6b55"
15181890 "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619"
1891 "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
15191892 "checksum rusttype 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4667e40922320e08b358ce9cfc7d08cc37a827f223c0e113b5dee573143a534d"
1893 "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
15201894 "checksum sdl2 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a74c2a98a354b20713b90cce70aef9e927e46110d1bc4ef728fd74e0d53eba60"
15211895 "checksum sdl2-sys 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5c543ce8a6e33a30cb909612eeeb22e693848211a84558d5a00bb11e791b7ab7"
1896 "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
1897 "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
15221898 "checksum serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "92514fb95f900c9b5126e32d020f5c6d40564c27a5ea6d1d7d9f157a96623560"
15231899 "checksum serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6eabf4b5914e88e24eea240bb7c9f9a2cbc1bbbe8d961d381975ec3c6b806c"
15241900 "checksum shell32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9ee04b46101f57121c9da2b151988283b6beb79b34f5bb29a58ee48cb695122c"
1901 "checksum shred 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c75ec29e8d2959ad96a1087fe4cadb926c6fc17cbae9812314fa8efe720aa2a"
1902 "checksum shred-derive 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fcf34e5e5302d3024aba7afc291f6d1ca7573ed035d3c0796976ba3f10691a1"
1903 "checksum shrev 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ec60ed6f60a4b3cdc2ceacf57215db3408fbd8990f66a38686a31558cd9da482"
15251904 "checksum sid 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "29e0a6006cf04d568a49363baca3dabddbbe46538f7c76692d405f5f5d140ecd"
15261905 "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be"
15271906 "checksum smart-default 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e7392ae8cdf79428cc98170bf264af7219887def8a30bb61d7ad2200313e88d"
1907 "checksum specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)" = "de65613ada4338aa7ba71eca60eca24c60483433eec0077bc4f33cfc31f4bdf0"
1908 "checksum specs-derive 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a63549fa0d4a6f76e99e6634c328f25d0c9fa8ad6f8498aef74f6c35c0b269e5"
1909 "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
15281910 "checksum stb_truetype 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "69b7df505db8e81d54ff8be4693421e5b543e08214bd8d99eb761fcb4d5668ba"
15291911 "checksum stdweb 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e"
15301912 "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
15371919 "checksum tiled 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e43db82e3c62f96d84482c1b69e8a9b9ceb1c5cd80bd2ee1669caec58f5831d"
15381920 "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
15391921 "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
1922 "checksum tuple_utils 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbfecd7bb8f0a3e96b3b31c46af2677a55a588767c0091f484601424fcb20e7e"
15401923 "checksum twox-hash 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "555cd4909480122bbbf21e34faac4cb08a171f324775670447ed116726c474af"
15411924 "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
15421925 "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
88 ggez = "0.4.4"
99 tiled = "0.8"
1010 itertools = "0.8"
11 specs = "0.14"
12 specs-derive = "0.4"
1 #[macro_use] extern crate itertools;
1 #[macro_use] extern crate specs_derive;
22
33 use ggez::{Context, ContextBuilder, GameResult};
44 use ggez::event::{self, EventHandler};
55 use ggez::graphics;
66
77 use std::path::Path;
8 use specs::{Component, RunNow, System, NullStorage, VecStorage};
9 use specs::world::Builder;
810
911 #[allow(dead_code)]
1012 mod consts {
1921 tiled::PropertyValue::BoolValue(true);
2022 }
2123
22 #[derive(Debug)]
23 struct Board {
24 tiles: Vec<Option<Tile>>,
25 entities: Vec<Option<Tile>>,
26 decoration: Vec<Option<Tile>>,
24 #[derive(Component, Debug)]
25 #[storage(VecStorage)]
26 struct Position {
27 x: f32,
28 y: f32,
2729 }
2830
29 impl Board {
30 fn from_file(path: &Path) -> Board {
31 let tiled::Map {
32 tilesets,
33 layers,
34 ..
35 } = tiled::parse_file(path).unwrap();
36 let read_layer = |idx: usize| {
37 layers[idx].tiles.iter()
38 .flat_map(|row| row)
39 .map(|&n| if n > 0 {
40 Some(Tile::from_tileset(n, &tilesets[0]))
41 } else {
42 None
43 })
44 .collect()
45 };
46 let tiles = read_layer(0);
47 let entities = read_layer(1);
48 let decoration = read_layer(2);
49 Board {
50 tiles,
51 entities,
52 decoration,
53 }
54 }
55
56 fn draw() {
57
31 impl Position {
32 fn to_point(&self) -> ggez::nalgebra::Point2<f32> {
33 ggez::nalgebra::Point2::new(self.x, self.y)
5834 }
5935 }
6036
61 #[derive(Debug, Clone)]
62 struct Tile {
63 action: Action,
64 sprite: (u8, u8),
65 pass: bool,
37 #[derive(Component, Debug)]
38 #[storage(VecStorage)]
39 struct Sprite {
40 u: u8,
41 v: u8,
6642 }
6743
68 impl Tile {
69 fn from_tileset(n: u32, tileset: &tiled::Tileset) -> Tile {
70 let x = (n - 1) % 32;
71 let y = (n - x - 1) / 32;
72 let pass = tileset.tiles[n as usize].properties.get("pass").eq(
73 &Some(&consts::TILED_TRUE));
74 Tile {
75 action: Action::NoAction,
76 sprite: (x as u8, y as u8),
77 pass: pass,
78 }
79 }
80
81 fn draw(&self, (y, x): (usize, usize)) -> graphics::DrawParam {
82 let (tx, ty) = self.sprite;
83 graphics::DrawParam {
84 src: graphics::Rect {
85 x: (1.0 / 32.0) * tx as f32,
86 y: (1.0 / 32.0) * ty as f32,
87 w: 1.0 / 32.0,
88 h: 1.0 / 32.0,
89 },
90 dest: ggez::nalgebra::Point2::new(
91 x as f32 * 24.0, y as f32 * 24.0),
92 ..Default::default()
44 impl Sprite {
45 fn to_rect(&self) -> graphics::Rect {
46 graphics::Rect {
47 x: (1.0 / 32.0) * self.u as f32,
48 y: (1.0 / 32.0) * self.v as f32,
49 w: 1.0 / 32.0,
50 h: 1.0 / 32.0,
9351 }
9452 }
9553 }
9654
97 #[derive(Debug, Clone)]
98 enum Action {
99 NoAction,
55 #[derive(Debug, Copy, Clone)]
56 enum DrawLayer {
57 Background,
58 Foreground,
59 Decoration,
60 }
61
62 static DRAW_LAYERS: [DrawLayer;3] = [
63 DrawLayer::Background,
64 DrawLayer::Foreground,
65 DrawLayer::Decoration,
66 ];
67
68 #[derive(Component, Default, Debug)]
69 #[storage(NullStorage)]
70 struct Background;
71
72 #[derive(Component, Default, Debug)]
73 #[storage(NullStorage)]
74 struct Foreground;
75
76 #[derive(Component, Default, Debug)]
77 #[storage(NullStorage)]
78 struct Decoration;
79
80 fn world_from_file(w: &mut specs::World, path: &Path) {
81 let tiled::Map {
82 layers,
83 ..
84 } = tiled::parse_file(path).unwrap();
85
86 for (phase, layer) in DRAW_LAYERS.iter().zip(layers) {
87 for (row, y) in layer.tiles.iter().zip(0..) {
88 for (&n, x) in row.iter().zip(0..) {
89 if n != 0 {
90 let x = x as f32 * 24.0;
91 let y = y as f32 * 24.0;
92 let u = ((n - 1) % 32) as u8;
93 let v = ((n - u as u32 - 1) / 32) as u8;
94 let mut e = w.create_entity()
95 .with(Position { x, y })
96 .with(Sprite { u, v });
97 e = match phase {
98 DrawLayer::Background => e.with(Background),
99 DrawLayer::Foreground => e.with(Foreground),
100 DrawLayer::Decoration => e.with(Decoration),
101 };
102 e.build();
103 }
104 }
105 }
106 }
100107 }
101108
102109 struct MyGame {
103 board: Board,
110 world: specs::World,
104111 sprites: graphics::spritebatch::SpriteBatch,
112 }
113
114 struct Draw<'t, Phase> {
115 ctx: &'t mut Context,
116 sprites: &'t mut graphics::spritebatch::SpriteBatch,
117 _phase: Phase,
118 }
119
120 impl<'a, 't, Phase: Component> System<'a> for Draw<'t, Phase> {
121 type SystemData = (
122 specs::ReadStorage<'a, Position>,
123 specs::ReadStorage<'a, Sprite>,
124 specs::ReadStorage<'a, Phase>,
125 );
126
127 fn run(&mut self, (positions, sprites, phase): Self::SystemData) {
128 use specs::Join;
129
130 for (pos, spr, _) in (&positions, &sprites, &phase).join() {
131 let param = graphics::DrawParam {
132 src: spr.to_rect(),
133 dest: pos.to_point(),
134 ..Default::default()
135 };
136 self.sprites.add(param);
137 graphics::draw(
138 self.ctx,
139 self.sprites,
140 ggez::nalgebra::Point2::new(0.0, 0.0),
141 0.0).unwrap();
142 self.sprites.clear();
143 }
144 }
105145 }
106146
107147 impl EventHandler for MyGame {
114154 use ggez::nalgebra as n;
115155 g::set_background_color(ctx, g::BLACK);
116156 g::clear(ctx);
117 for layer in [ &self.board.tiles, &self.board.entities, &self.board.decoration ].iter() {
118 for (pt, t) in iproduct!((0..consts::BOARD_HEIGHT),
119 (0..consts::BOARD_WIDTH)).zip(
120 layer.iter()) {
121 if let Some(t) = t {
122 self.sprites.add(t.draw(pt));
123 }
124 }
125 }
157
158 Draw { ctx, sprites: &mut self.sprites, _phase: Background }.run_now(&self.world.res);
159 Draw { ctx, sprites: &mut self.sprites, _phase: Foreground }.run_now(&self.world.res);
160 Draw { ctx, sprites: &mut self.sprites, _phase: Decoration }.run_now(&self.world.res);
161
126162 g::draw(ctx, &self.sprites, n::Point2::new(0.0, 0.0), 0.0)?;
127163 self.sprites.clear();
128164 g::present(ctx);
131167 }
132168
133169 fn main() -> Result<(), ggez::error::GameError> {
170 let mut world = specs::World::new();
171 world.register::<Position>();
172 world.register::<Sprite>();
173 world.register::<Background>();
174 world.register::<Foreground>();
175 world.register::<Decoration>();
176
177 world_from_file(&mut world, &Path::new("assets/main.tmx"));
178
134179 // Make a Context and an EventLoop.
135 let board = Board::from_file(&Path::new("assets/main.tmx"));
136180 let mut ctx = ContextBuilder::new("game", "me")
137181 .add_resource_path({
138182 let base = std::env::var("CARGO_MANIFEST_DIR").unwrap();
145189 let sprites = graphics::spritebatch::SpriteBatch::new(image);
146190
147191 let mut my_game = MyGame {
148 board,
192 world,
149193 sprites,
150194 };
151195