world-digger-amethyst

[Archive] Game about Digging a lot using upgradable tools. Made using the Amethyst Engine. Might resume work on it eventually.
git clone https://git.jojolepro.com/world-digger-amethyst.git
Log | Files | Refs | README | LICENSE

commit 429124d7f1bfc2e42f3e271e7beade3fce296f72
parent 365af45a4c821abfaec41d827d06f7abbb61c1f9
Author: Joël Lupien (Jojolepro) <jojolepromain@gmail.com>
Date:   Fri,  9 Mar 2018 14:03:12 -0500

Buy menu progress

Diffstat:
MCargo.lock | 129+++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
MCargo.toml | 1+
Msrc/main.rs | 61++++++++++++++++++++++++++++++++++++++++++++++++++++---------
Msrc/ui.rs | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
4 files changed, 208 insertions(+), 59 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock @@ -18,7 +18,7 @@ dependencies = [ [[package]] name = "amethyst" version = "0.6.0" -source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#bb15fa601695e5f19cc1f1256c281580f1868e16" +source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#47e3bda5abbe58697bc633ed1864be9d9282e8b0" dependencies = [ "amethyst_assets 0.2.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", "amethyst_audio 0.1.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", @@ -57,7 +57,7 @@ dependencies = [ [[package]] name = "amethyst_assets" version = "0.2.0" -source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#bb15fa601695e5f19cc1f1256c281580f1868e16" +source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#47e3bda5abbe58697bc633ed1864be9d9282e8b0" dependencies = [ "amethyst_core 0.1.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", "crossbeam 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -74,7 +74,7 @@ dependencies = [ [[package]] name = "amethyst_audio" version = "0.1.0" -source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#bb15fa601695e5f19cc1f1256c281580f1868e16" +source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#47e3bda5abbe58697bc633ed1864be9d9282e8b0" dependencies = [ "amethyst_assets 0.2.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", "amethyst_core 0.1.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", @@ -89,16 +89,16 @@ dependencies = [ [[package]] name = "amethyst_config" version = "0.5.0" -source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#bb15fa601695e5f19cc1f1256c281580f1868e16" +source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#47e3bda5abbe58697bc633ed1864be9d9282e8b0" dependencies = [ "ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "amethyst_controls" version = "0.1.0" -source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#bb15fa601695e5f19cc1f1256c281580f1868e16" +source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#47e3bda5abbe58697bc633ed1864be9d9282e8b0" dependencies = [ "amethyst_core 0.1.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", "amethyst_input 0.2.1 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", @@ -112,7 +112,7 @@ dependencies = [ [[package]] name = "amethyst_core" version = "0.1.0" -source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#bb15fa601695e5f19cc1f1256c281580f1868e16" +source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#47e3bda5abbe58697bc633ed1864be9d9282e8b0" dependencies = [ "cgmath 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -120,7 +120,7 @@ dependencies = [ "hibitset 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", "shred 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -128,13 +128,13 @@ dependencies = [ [[package]] name = "amethyst_input" version = "0.2.1" -source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#bb15fa601695e5f19cc1f1256c281580f1868e16" +source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#47e3bda5abbe58697bc633ed1864be9d9282e8b0" dependencies = [ "amethyst_config 0.5.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", "amethyst_core 0.1.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", "derivative 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", "shrev 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -144,7 +144,7 @@ dependencies = [ [[package]] name = "amethyst_renderer" version = "0.6.1" -source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#bb15fa601695e5f19cc1f1256c281580f1868e16" +source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#47e3bda5abbe58697bc633ed1864be9d9282e8b0" dependencies = [ "amethyst_assets 0.2.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", "amethyst_core 0.1.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", @@ -161,8 +161,8 @@ dependencies = [ "imagefmt 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", "shred 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "shrev 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -174,7 +174,7 @@ dependencies = [ [[package]] name = "amethyst_ui" version = "0.2.0" -source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#bb15fa601695e5f19cc1f1256c281580f1868e16" +source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#47e3bda5abbe58697bc633ed1864be9d9282e8b0" dependencies = [ "amethyst_assets 0.2.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", "amethyst_core 0.1.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", @@ -197,7 +197,7 @@ dependencies = [ [[package]] name = "amethyst_utils" version = "0.2.0" -source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#bb15fa601695e5f19cc1f1256c281580f1868e16" +source = "git+https://github.com/jojolepro/amethyst?branch=uilayout#47e3bda5abbe58697bc633ed1864be9d9282e8b0" dependencies = [ "amethyst_core 0.1.0 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", "amethyst_input 0.2.1 (git+https://github.com/jojolepro/amethyst?branch=uilayout)", @@ -257,7 +257,7 @@ name = "backtrace-sys" version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -296,7 +296,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -309,7 +309,7 @@ name = "cgl" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gleam 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)", + "gleam 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -332,7 +332,7 @@ dependencies = [ "mint 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -394,7 +394,7 @@ dependencies = [ "cgmath 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -546,7 +546,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -645,7 +645,7 @@ dependencies = [ "derivative 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "draw_state 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -723,7 +723,7 @@ dependencies = [ [[package]] name = "gleam" -version = "0.4.23" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -895,7 +895,7 @@ name = "miniz-sys" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -920,7 +920,7 @@ version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-complex 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", + "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", "num-iter 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -940,7 +940,7 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.1.42" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1100,6 +1100,14 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "proc-macro2" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "pulse" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1124,6 +1132,14 @@ version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "quote" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "rand" version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1192,7 +1208,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgmath 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "collision 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1204,7 +1220,7 @@ dependencies = [ "cgmath 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "collision 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rhusics-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", "shrev 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1228,7 +1244,7 @@ name = "ron" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1280,29 +1296,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.27" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.27" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive_internals 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive_internals" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", - "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1347,7 +1364,7 @@ name = "smallvec" version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1367,7 +1384,7 @@ dependencies = [ "hibitset 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "mopa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)", "shred 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "shred-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tuple_utils 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1406,6 +1423,16 @@ dependencies = [ ] [[package]] +name = "syn" +version = "0.12.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "synom" version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1478,6 +1505,11 @@ version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] name = "unreachable" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1632,6 +1664,7 @@ dependencies = [ "rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)", "rhusics-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rhusics-ecs 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "shred 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "shrev 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "specs 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1704,7 +1737,7 @@ dependencies = [ "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf" "checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" "checksum byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "652805b7e73fada9d85e9a6682a4abd490cb52d96aeecc12e33a0de34dfd0d23" -"checksum cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9be26b24e988625409b19736d130f0c7d224f01d06454b5f81d8d23d6c1a618f" +"checksum cc 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fedf677519ac9e865c4ff43ef8f930773b37ed6e6ea61b6b83b400a7b5787f49" "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de" "checksum cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "86765cb42c2a2c497e142af72517c1b4d7ae5bb2f25dfa77a5c69642f2342d89" "checksum cgmath 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "87f025a17ad3f30d49015c787903976d5f9cd6115ece1eb7f4d6ffe06b8c4080" @@ -1751,7 +1784,7 @@ dependencies = [ "checksum gfx_window_glutin 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73aec7a95849ce5f1de58d8fa032e4310d1e9f988f43ce2ab3ba8ea6430acd2b" "checksum gl_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4f5c19cde55637681450c92f7a05ea16c78e2b6d0587e601ec1ebdab6960854b" "checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a" -"checksum gleam 0.4.23 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a7f5351837630a7dd0cd6d7976de547929f9fabd381b9d5ac35f82e90be2" +"checksum gleam 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "8d9997e65a2cfec0f3290a8378652e3aacdb3f19d29a7ca20c11e11ca550eec9" "checksum glutin 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)" = "247f825056c99961b6e6e0baef17ca586a50109ab4bba2b370babe1c5d702943" "checksum hetseq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe13b9e03ea85e9efb4cd214c760399619f5e9ad0b36d8656b6649f03645063" "checksum hibitset 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b78998e3c243d71525596e8f373dfc4b82703f25907b9e4d260383cff8307d84" @@ -1779,7 +1812,7 @@ dependencies = [ "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" "checksum num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "4703ad64153382334aa8db57c637364c322d3372e097840c72000dabdcf6156e" "checksum num-bigint 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "81b483ea42927c463e191802e7334556b48e7875297564c0e9951bd3a0ae53e3" -"checksum num-complex 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "26ff8edeab9f1d8cf6b595e35138c2a389ea29f4f57a0e6bc44abf406e4b0077" +"checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" "checksum num-integer 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "f8d26da319fb45674985c78f1d1caf99aa4941f785d384a2ae36d0740bc3e2fe" "checksum num-iter 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "4b226df12c5a59b63569dd57fafb926d91b385dfce33d8074a412411b689d593" "checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" @@ -1799,9 +1832,11 @@ dependencies = [ "checksum parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "538ef00b7317875071d5e00f603f24d16f0b474c1a5fc0ccb8b454ca72eafa79" "checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903" +"checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0" "checksum pulse 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "655612b6c8d96a8a02f331fe296cb4f925b68e87c1d195544675abca2d9b9af0" "checksum quickcheck 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "02c2411d418cea2364325b18a205664f9ef8252e06b2e911db97c0b0d98b1406" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" +"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408" "checksum rand 0.3.22 (registry+https://github.com/rust-lang/crates.io-index)" = "15a732abf9d20f0ad8eeb6f909bf6868722d9a06e1e50802b6a70351f40b4eb1" "checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" "checksum rayon 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b614fe08b6665cb9a231d07ac1364b0ef3cb3698f1239ee0c4c3a88a524f54c8" @@ -1820,9 +1855,9 @@ dependencies = [ "checksum rusttype 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "24f3d32ca1619041480bd0b4756963762369f1d3f2fcc212c4877042f867b4ca" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" -"checksum serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "db99f3919e20faa51bb2996057f5031d8685019b5a06139b1ce761da671b8526" -"checksum serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ba7591cfe93755e89eeecdbcc668885624829b020050e6aec99c2a03bd3fd0" -"checksum serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e03f1c9530c3fb0a0a5c9b826bdd9246a5921ae995d75f512ac917fc4dd55b5" +"checksum serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)" = "4763b773978e495252615e814d2ad04773b2c1f85421c7913869a537f35cb406" +"checksum serde_derive 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)" = "8ab31f00ae5574bb643c196d5e302961c122da1c768604c6d16a35c5d551948a" +"checksum serde_derive_internals 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc848d073be32cd982380c06587ea1d433bc1a4c4a111de07ec2286a3ddade8" "checksum shared_library 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8254bf098ce4d8d7cc7cc6de438c5488adc5297e5b7ffef88816c0a91bd289c1" "checksum shred 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d3abceaa9d0a9b47ab84b53c6029c21bcad7d7dd63e14db51ea0680faee2159" "checksum shred-derive 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4a894913b6e93fe2cd712a3bc955ec6f6b01c675c1c58b02fdfa13f77868049" @@ -1834,6 +1869,7 @@ dependencies = [ "checksum stb_truetype 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "52ce2b38abdd11cffbc68928810248e0dd003fea489a88a404dc1ba7ae2d5538" "checksum syn 0.10.8 (registry+https://github.com/rust-lang/crates.io-index)" = "58fd09df59565db3399efbba34ba8a2fec1307511ebd245d0061ff9d42691673" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" +"checksum syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)" = "8c5bc2d6ff27891209efa5f63e9de78648d7801f085e4653701a692ce938d6fd" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" "checksum tempfile 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "11ce2fe9db64b842314052e2421ac61a73ce41b898dc8e3750398b219c5fc1e0" "checksum thread-id 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a9539db560102d1cef46b8b78ce737ff0bb64e7e18d35b2a5688f7d097d0ff03" @@ -1844,6 +1880,7 @@ dependencies = [ "checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f" "checksum unicode-segmentation 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a8083c594e02b8ae1654ae26f0ade5158b119bd88ad0e8227a5d8fcd72407946" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91" "checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" "checksum vergen 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c3365f36c57e5df714a34be40902b27a992eeddb9996eca52d0584611cf885d" diff --git a/Cargo.toml b/Cargo.toml @@ -10,5 +10,6 @@ rhusics-ecs = { version = "0.1", features = ["eders"] } rhusics-core = { version = "0.1", features = ["specs", "eders"] } specs = "0.10" shrev = "0.8" +shred = "0.5" collision = "0.14" rand = "0.3" \ No newline at end of file diff --git a/src/main.rs b/src/main.rs @@ -3,6 +3,7 @@ extern crate amethyst_rhusics; extern crate rhusics_core; extern crate rhusics_ecs; extern crate collision; +extern crate shred; use amethyst::{Application, Error, State, Trans}; use amethyst::assets::{Loader,AssetStorage,Handle}; @@ -10,17 +11,19 @@ use amethyst::config::Config; use amethyst::controls::{FlyControlTag,FlyControlBundle}; use amethyst::core::frame_limiter::FrameRateLimitStrategy; use amethyst::core::transform::{GlobalTransform, Transform, TransformBundle}; -use amethyst::core::{Time,Parent}; +use amethyst::core::{Time,Parent,ECSBundle}; use amethyst::ecs::{World,VecStorage,Component,Fetch,Entity,System,Join,ReadStorage,FetchMut,Entities,WriteStorage}; use amethyst::input::{InputBundle,InputHandler}; use amethyst::renderer::{AmbientColor, Camera, DisplayConfig, DrawShaded, ElementState, Event, KeyboardInput, Material, MaterialDefaults, MeshHandle, ObjFormat, Pipeline, PosNormTex, Projection, RenderBundle, Rgba, Stage, - VirtualKeyCode, WindowEvent,Texture,MouseButton}; + VirtualKeyCode, WindowEvent,Texture,MouseButton,ScreenDimensions,WindowMessages}; +use amethyst::renderer::mouse::{release_cursor,grab_cursor,set_mouse_cursor_none,set_mouse_cursor}; use amethyst::shrev::EventChannel; use amethyst::ui::{Anchor, Anchored, DrawUi, FontAsset, MouseReactive, Stretch, Stretched, TtfFormat, UiBundle, UiEvent, UiFocused, UiImage, UiText, UiTransform,TextEditing}; +use amethyst::winit::MouseCursor; use amethyst_rhusics::{time_sync, DefaultBasicPhysicsBundle3,SpatialPhysicsBundle3}; use collision::{Aabb3,Ray3}; @@ -33,6 +36,8 @@ use rhusics_ecs::physics3d::{register_physics,BodyPose3, CollisionMode, SpatialCollisionSystem3,GJK3,CurrentFrameUpdateSystem3,NextFrameSetupSystem3,ContactResolutionSystem3,Velocity3}; use amethyst::core::cgmath::{Deg, Array, Basis3,Basis2, One, Point3, Quaternion, Vector3,Matrix3,Zero,EuclideanSpace,Rotation}; +use shred::{Dispatcher,DispatcherBuilder}; + mod player; use player::{Tool,Backpack,BlockDefinition,BlockDefinitions,BlockInstance,Inventory,UiUpdaterSystem,MineProgress}; mod ui; @@ -201,10 +206,18 @@ struct BuyMenuState{ impl State for BuyMenuState{ fn on_start(&mut self, mut world: &mut World){ self.local_entities = create_buy_ui(&mut world); + release_cursor(&mut world.write_resource()); + set_mouse_cursor(&mut world.write_resource(),MouseCursor::Default); } fn on_stop(&mut self, mut world: &mut World){ world.delete_entities(self.local_entities.as_slice()); + let dim = world.read_resource::<ScreenDimensions>(); + let mut msg = world.write_resource::<WindowMessages>(); + + // Make mouse hidden again + grab_cursor(&mut msg); + set_mouse_cursor_none(&mut msg); } fn handle_event(&mut self, _: &mut World, event: Event) -> Trans { if event_was_key_pressed(event,VirtualKeyCode::P){ @@ -215,10 +228,40 @@ impl State for BuyMenuState{ } } -struct ExampleState; +struct GameState{ + dispatcher: Option<Dispatcher<'static,'static>>, +} + +impl GameState{ + pub fn new() -> Self{ + GameState{ + dispatcher: None, + } + } +} + +pub fn with_bundle<B>(mut disp_builder: DispatcherBuilder<'static,'static>,mut world: &mut World, bundle: B) -> DispatcherBuilder<'static,'static> + where + B: ECSBundle<'static, 'static>, +{ + bundle + .build(&mut world, disp_builder) + .expect("Failed to add bundle to dispatcher builder") +} + -impl State for ExampleState { +impl State for GameState { fn on_start(&mut self, mut world: &mut World) { + let mut dispatcher = DispatcherBuilder::new() + .add(MiningSystem::new(),"mining",&[]); + dispatcher = with_bundle(dispatcher, &mut world,FlyControlBundle::<String, String>::new( + Some(String::from("move_x")), + Some(String::from("move_y")), + Some(String::from("move_z")), + ).with_speed(20.0).with_sensitivity(0.3,0.3)); + self.dispatcher = Some(dispatcher.build()); + + initialise_camera(world); let (mut comps,cube) = { @@ -389,6 +432,7 @@ impl State for ExampleState { fn update(&mut self, world: &mut World) -> Trans { time_sync(world); + self.dispatcher.as_mut().unwrap().dispatch(&mut world.res); Trans::None } } @@ -437,13 +481,13 @@ fn run() -> Result<(), Error> { let reader_2 = channel .register_reader();*/ - let mut game = Application::build(resources_directory, ExampleState)? + let mut game = Application::build(resources_directory, GameState::new())? .with_frame_limit(FrameRateLimitStrategy::Unlimited, 0) - .with_bundle(FlyControlBundle::<String, String>::new( + /*.with_bundle(FlyControlBundle::<String, String>::new( Some(String::from("move_x")), Some(String::from("move_y")), Some(String::from("move_z")), - ).with_speed(20.0).with_sensitivity(0.3,0.3))? + ).with_speed(20.0).with_sensitivity(0.3,0.3))?*/ .with_bundle(UiBundle::<String,String>::new())? .with_bundle( InputBundle::<String, String>::new().with_bindings_from_file(&key_bindings_path), @@ -451,8 +495,7 @@ fn run() -> Result<(), Error> { .with_bundle(RenderBundle::new(pipeline_builder, Some(display_config)))? .with_bundle(SpatialPhysicsBundle3::<Primitive3<f32>,Aabb3<f32>,ObjectType>::new())? .with(UiUpdaterSystem,"ui_updater",&[]) - .with(MiningSystem::new(),"mining",&[]) - .with_bundle(TransformBundle::new().with_dep(&["fly_movement","sync_system"]))? + .with_bundle(TransformBundle::new().with_dep(&["sync_system"]))? .build()?; game.run(); Ok(()) diff --git a/src/ui.rs b/src/ui.rs @@ -226,8 +226,8 @@ pub fn create_buy_ui(mut world: &mut World)->Vec<Entity>{ "toolbg".to_string(), 270., 0., - -1., - 500., + -11., + 800., 0., 1, )) @@ -241,6 +241,73 @@ pub fn create_buy_ui(mut world: &mut World)->Vec<Entity>{ }) .build(); + let btn1_back = world + .create_entity() + .with(UiTransform::new( + "btn1_back".to_string(), + 0., + 60., + -12., + 0., + 80., + 1, + )) + .with(UiImage { + texture: ui.red.clone(), + }) + .with(Anchored::new(Anchor::TopMiddle)) + .with(Stretched::new(Stretch::X)) + .with(Parent{ + entity: tool_bg, + }) + .build(); + + let btn1_txt = world + .create_entity() + .with(UiTransform::new( + "btn1_txt".to_string(), + 350., + 0., + -13., + 400., + 60., + 1, + )) + .with(UiText::new( + ui.font.clone(), + "Spoon".to_string(), + [0.2, 0.2, 1.0, 1.0], + 50., + )) + .with(Anchored::new(Anchor::MiddleLeft)) + .with(Parent{ + entity: btn1_back, + }) + .build(); + + let btn1_price = world + .create_entity() + .with(UiTransform::new( + "btn1_price".to_string(), + 0., + 0., + -13., + 250., + 60., + 1, + )) + .with(UiText::new( + ui.font.clone(), + "0$".to_string(), + [0.2, 0.2, 1.0, 1.0], + 50., + )) + .with(Anchored::new(Anchor::MiddleRight)) + .with(Parent{ + entity: btn1_back, + }) + .build(); + out.push(world .create_entity() .with(UiTransform::new( @@ -264,10 +331,11 @@ pub fn create_buy_ui(mut world: &mut World)->Vec<Entity>{ }) .build()); - println!("tool_bg: {:?}",tool_bg); - out.push(bg); out.push(tool_bg); + out.push(btn1_back); + out.push(btn1_txt); + out.push(btn1_price); out }