├── .gitignore ├── .travis.yml ├── AUTHORS.md ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── build.rs ├── rustfmt.toml ├── src ├── error.rs ├── fetch.rs ├── lib.rs ├── main.rs ├── new.rs └── templates.rs ├── templates ├── 0.10.0 │ ├── index.ron │ └── main │ │ ├── .gitignore │ │ ├── Cargo.toml.gdpu │ │ ├── resources │ │ └── display_config.ron.gdpu │ │ └── src │ │ └── main.rs.gdpu ├── 0.11.0 │ ├── index.ron │ └── main │ │ ├── .gitignore │ │ ├── Cargo.toml.gdpu │ │ ├── README.md.gdpu │ │ ├── resources │ │ └── display_config.ron.gdpu │ │ └── src │ │ └── main.rs.gdpu ├── 0.12.0 │ ├── index.ron │ └── main │ │ ├── .gitignore │ │ ├── Cargo.toml.gdpu │ │ ├── README.md.gdpu │ │ ├── config │ │ └── display.ron.gdpu │ │ └── src │ │ └── main.rs.gdpu ├── 0.13.2 │ ├── index.ron │ └── main │ │ ├── .gitignore │ │ ├── Cargo.toml.gdpu │ │ ├── README.md.gdpu │ │ ├── assets │ │ └── .gitkeep │ │ ├── config │ │ └── display.ron.gdpu │ │ └── src │ │ └── main.rs.gdpu ├── 0.14.0 │ ├── index.ron │ └── main │ │ ├── .gitignore │ │ ├── Cargo.toml.gdpu │ │ ├── README.md.gdpu │ │ ├── assets │ │ └── .gitkeep │ │ ├── config │ │ └── display.ron.gdpu │ │ └── src │ │ └── main.rs.gdpu ├── 0.15.0 │ ├── index.ron │ └── main │ │ ├── .gitignore │ │ ├── Cargo.toml.gdpu │ │ ├── README.md.gdpu │ │ ├── assets │ │ └── .gitkeep │ │ ├── config │ │ └── display.ron.gdpu │ │ └── src │ │ └── main.rs.gdpu ├── 0.6.0 │ ├── index.ron │ └── main │ │ ├── .gitignore │ │ ├── Cargo.toml.gdpu │ │ ├── resources │ │ └── display_config.ron.gdpu │ │ └── src │ │ └── main.rs.gdpu ├── 0.7.0 │ ├── index.ron │ └── main │ │ ├── .gitignore │ │ ├── Cargo.toml.gdpu │ │ ├── resources │ │ └── display_config.ron.gdpu │ │ └── src │ │ └── main.rs.gdpu ├── 0.8.0 │ ├── index.ron │ └── main │ │ ├── .gitignore │ │ ├── Cargo.toml.gdpu │ │ ├── resources │ │ └── display_config.ron.gdpu │ │ └── src │ │ └── main.rs.gdpu └── 0.9.0 │ ├── index.ron │ └── main │ ├── .gitignore │ ├── Cargo.toml.gdpu │ ├── resources │ └── display_config.ron.gdpu │ └── src │ └── main.rs.gdpu └── tests └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | Cargo.lock 4 | 5 | # Backup files 6 | .DS_Store 7 | thumbs.db 8 | *~ 9 | *.rs.bk 10 | *.swp 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: rust 3 | 4 | cache: 5 | cargo: true 6 | directories: 7 | - "$HOME/kcov" 8 | 9 | branches: 10 | only: 11 | - staging 12 | - trying 13 | - develop 14 | - master 15 | 16 | addons: 17 | apt: 18 | packages: 19 | - libcurl4-openssl-dev 20 | - libelf-dev 21 | - libdw-dev 22 | - cmake 23 | - gcc 24 | - binutils-dev 25 | 26 | os: 27 | - linux 28 | - osx 29 | - windows 30 | 31 | rust: 32 | - stable 33 | - beta 34 | - nightly 35 | 36 | stages: 37 | - check formatting 38 | - lint 39 | - test 40 | - coverage 41 | 42 | jobs: 43 | include: 44 | - stage: check formatting 45 | rust: stable 46 | install: 47 | - rustup component add rustfmt 48 | script: 49 | - cargo fmt --all -- --check 50 | - stage: lint 51 | rust: stable 52 | install: 53 | - rustup component add clippy 54 | script: 55 | - cargo clippy --all-targets --all-features --verbose -- -D clippy::pedantic -D warnings 56 | - stage: coverage 57 | rust: stable 58 | script: | 59 | if [ ! -d "{HOME}/kcov" ]; then 60 | wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz && 61 | tar xzf master.tar.gz && 62 | cd kcov-master && 63 | mkdir build && 64 | cd build && 65 | cmake -DCMAKE_INSTALL_PREFIX=${HOME}/kcov .. && 66 | make && 67 | make install 68 | cd ../.. && 69 | rm -rf kcov-master 70 | fi 71 | for file in target/debug/{amethyst-*,amethyst_cli-*}; do [ -x "${file}" ] || continue; mkdir -p "target/cov/$(basename $file)"; ${HOME}/kcov/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file"; done && 72 | bash <(curl -s https://codecov.io/bash) && 73 | echo "Uploaded code coverage" 74 | 75 | script: 76 | - cargo test --all 77 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | # Authors 2 | 3 | Eyal Kalderon ([ebkalderon](https://github.com/ebkalderon)) 4 | 5 | [White-Oak](https://github.com/White-Oak) 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable per-release changes will be documented in this file. This project 4 | adheres to [Semantic Versioning][sv]. 5 | 6 | [sv]: http://semver.org/ 7 | 8 | ## 0.10.0 9 | 10 | * Added 0.15.0 template, which chooses a default graphics backend based on the developer's operating system. ([#104]) 11 | 12 | [#104]: https://github.com/amethyst/tools/pull/104 13 | 14 | ## 0.9.1 15 | 16 | * Updated `liquid-value` to allow `amethyst_tools` to build ([#96]) 17 | 18 | [#96]: https://github.com/amethyst/tools/issues/96 19 | 20 | ## 0.7.0 21 | 22 | * Complete rewrite of the tool 23 | 24 | ## 0.4.0 (2016-03-XX) 25 | 26 | ### Added 27 | * Amethyst CLI 28 | * Add support for `--release` flag (issue #19) 29 | 30 | ### Fixed 31 | * Amethyst CLI 32 | * Fix for bad file descriptor error for new command (pull request [#18]) 33 | 34 | [#18]: https://github.com/amethyst/tools/issues/18 35 | [#19]: https://github.com/amethyst/tools/issues/19 36 | 37 | ## 0.3.0 (2016-02-23) 38 | 39 | ### Added 40 | * Amethyst CLI 41 | * New integration test for detecting failed builds 42 | 43 | ### Changed 44 | * Amethyst CLI 45 | * `check_new` integration test checks for exit status (pull request [#14]) 46 | * Reduce verbosity with `try!` (pull request [#16]) 47 | 48 | [#14]: https://github.com/amethyst/tools/issues/14 49 | [#16]: https://github.com/amethyst/tools/issues/16 50 | 51 | ### Fixed 52 | * General 53 | * Recent changes to crates.io breaks `amethyst_tools` installation for some 54 | users (issue [#17]) 55 | * Amethyst CLI 56 | * Expose Cargo exit status if non-zero (issue [#13]) 57 | 58 | [#13]: https://github.com/amethyst/tools/issues/13 59 | [#17]: https://github.com/amethyst/tools/issues/17 60 | 61 | ## 0.2.4 (2016-02-11) 62 | 63 | ### Fixed 64 | * Amethyst CLI 65 | * Properly print errors and warnings from Cargo (issue [#7]) 66 | * Overhaul `new` command and stomp out bugs (issue [#8], [#9], [#10]) 67 | 68 | [#7]: https://github.com/amethyst/tools/issues/7 69 | [#8]: https://github.com/amethyst/tools/issues/8 70 | [#9]: https://github.com/amethyst/tools/issues/9 71 | [#10]: https://github.com/amethyst/tools/issues/10 72 | 73 | ## 0.2.0 (2016-01-27) 74 | 75 | ### Added 76 | * General 77 | * New repo-wide README.md 78 | * Amethyst CLI 79 | * New project template, updated to use 0.2.0 engine API 80 | 81 | ### Changed 82 | * Renamed repository to `amethyst_tools`, general restructuring (issue [#4]) 83 | * New change log format (issue [#5]) 84 | 85 | [#4]: https://github.com/amethyst/tools/issues/4 86 | [#5]: https://github.com/amethyst/tools/issues/5 87 | 88 | ## 0.1.4 (2016-01-13) 89 | 90 | ### Fixed 91 | * Amethyst CLI 92 | * Display Cargo stdout in real-time, not when the process exits (issue [#1]) 93 | 94 | [#1]: https://github.com/amethyst/tools/issues/1 95 | 96 | ## 0.1.3 (2016-01-12) 97 | 98 | ### Changed 99 | * Amethyst CLI 100 | * Do not print to stdout when extracting the template project files 101 | * Eliminate all unused variable warnings 102 | 103 | ## 0.1.2 (2016-01-11) 104 | 105 | ### Changed 106 | * Amethyst CLI 107 | * Update template project's `main.rs` to eliminate unused variable warning 108 | 109 | ## 0.1.1 (2016-01-10) 110 | 111 | ### Changed 112 | * Amethyst CLI 113 | * Update included `main.rs` in the template project to API version 0.1.3 114 | * Remove unused zip-rs dependency "bzip2" 115 | 116 | ## 0.1.0 (2016-01-07) 117 | 118 | * Initial release 119 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "amethyst_tools" 3 | version = "0.11.0" 4 | authors = ["Eyal Kalderon "] 5 | description = "Game development tools for the Amethyst engine" 6 | keywords = ["game", "engine", "tool", "editor", "amethyst"] 7 | edition = "2018" 8 | build = "build.rs" 9 | 10 | repository = "https://github.com/amethyst/amethyst_tools" 11 | 12 | readme = "README.md" 13 | license = "MIT/Apache-2.0" 14 | 15 | [lib] 16 | name = "amethyst_cli" 17 | path = "src/lib.rs" 18 | 19 | [[bin]] 20 | name = "amethyst" 21 | path = "src/main.rs" 22 | 23 | [dependencies] 24 | ansi_term = "0.11.0" 25 | clap = "2.33.0" 26 | env_proxy = "0.3.1" 27 | error-chain = "0.12.2" 28 | liquid = "0.19.0" 29 | regex = "1.1.7" 30 | serde = "1.0.92" 31 | serde_derive = "1.0.92" 32 | serde_json = "1.0.39" 33 | 34 | [dependencies.reqwest] 35 | version = "0.9.18" 36 | default-features = false 37 | features = ["rustls-tls"] 38 | 39 | [dependencies.semver] 40 | features = ["serde"] 41 | version = "0.9.0" 42 | 43 | [build-dependencies] 44 | ron = "0.5.1" 45 | walkdir = "2.2.8" 46 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 The Amethyst Project Developers 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED 2 | 3 | This project has been deprecated. For more details please see [this forum post]. 4 | 5 | [this forum post]: https://community.amethyst.rs/t/end-of-life-for-amethyst-tools-the-cli/1656 6 | 7 | # Amethyst Tools 8 | 9 | [![Build Status][s1]][tc] [![Crates.io][s2]][ci] [![MIT/Apache License][s3]][li] 10 | [![Join us on Discord][s4]][di] [![Code coverage][s5]][cc] 11 | 12 | [s1]: https://travis-ci.org/amethyst/tools.svg?branch=master 13 | [s2]: https://img.shields.io/crates/v/amethyst_tools.svg 14 | [s3]: https://img.shields.io/badge/license-MIT%2FApache-blue.svg 15 | [s4]: https://img.shields.io/discord/425678876929163284.svg?logo=discord 16 | [s5]: https://img.shields.io/codecov/c/github/amethyst/tools.svg 17 | 18 | [tc]: https://travis-ci.org/amethyst/tools/ 19 | [ci]: https://crates.io/crates/amethyst_tools/ 20 | [li]: https://github.com/amethyst/tools/blob/master/COPYING 21 | [di]: https://discord.gg/GnP5Whs 22 | [cc]: https://codecov.io/gh/amethyst/tools 23 | 24 | 25 | Command-line interface for the [Amethyst][am] engine to create and deploy game 26 | projects. This project is a *work in progress* and is very incomplete; pardon 27 | the dust! 28 | 29 | [am]: https://github.com/amethyst/amethyst 30 | 31 | ## Vision 32 | 33 | One of the goals of [Amethyst][am] is to split up the traditional "mega-editor" 34 | seen in many other game engines into several small but well-integrated tools, 35 | adhering to the [Unix philosophy][up]. This approach allows for nifty things 36 | like: 37 | 38 | [up]: https://en.wikipedia.org/wiki/Unix_philosophy 39 | 40 | * Piping and streaming data between tools like regular Unix commands. 41 | * Network transparency (e.g. mirroring gameplay from your development machine 42 | onto a testbed computer or smartphone). 43 | * Customizing your workflow to your liking with plain ol' shell scripts. 44 | * Stripping out tools you don't want or need, or easily supplanting them with 45 | third-party utilities. 46 | * Serving as backends for various "mega-editors" provided by third parties or 47 | written in-house. 48 | 49 | ## Installing 50 | 51 | By executing 52 | 53 | ```sh 54 | cargo install amethyst_tools 55 | ``` 56 | 57 | a binary called `amethyst` will be placed in your `~/cargo/bin` folder. 58 | 59 | ## Usage 60 | 61 | ### Creating a new project 62 | 63 | ```sh 64 | amethyst new 65 | ``` 66 | 67 | ## Contributing 68 | 69 | **Note:** Any interaction with the Amethyst project is subject to our [Code of Conduct][coc]. 70 | 71 | Amethyst is a community-based project that welcomes contributions from anyone. If you're interested in helping out, please read the [contribution guidelines][cm] before getting started. 72 | 73 | We have a [good first issue][gfi] category that groups all issues or feature requests that can be made without having an extensive knowledge of Rust or Amethyst. Working on those issues is a good, if not the best, way to learn. 74 | 75 | If you think you are not ready to code yet, you can still contribute by reviewing code written by other members of the community. Code reviews ensure that code merged into Amethyst is of the highest quality as possible. Pull requests that are available for reviews can be found [here][pr]. 76 | 77 | If for some reason we don't have any open PRs in need of a review nor any good first issues (that would be a good thing), feel free to consult our [issue tracker][it]. 78 | 79 | [coc]: https://github.com/amethyst/amethyst/blob/master/CODE_OF_CONDUCT.md 80 | [cm]: https://github.com/amethyst/amethyst/blob/master/docs/CONTRIBUTING.md 81 | [gfi]: https://github.com/amethyst/tools/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22 82 | [pr]: https://github.com/amethyst/tools/pulls 83 | [it]: https://github.com/amethyst/tools/issues 84 | 85 | ## License 86 | 87 | Amethyst is free and open source software distributed under the terms of both the [MIT License][lm] and the [Apache License 2.0][la]. 88 | 89 | [lm]: LICENSE-MIT 90 | [la]: LICENSE-APACHE 91 | 92 | Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. 93 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | //! Reads the `templates/` directory and includes all versions' templates as 2 | //! part of the binary to reduce installation footprint 3 | use std::{ 4 | env, 5 | fs::{read_dir, File}, 6 | io::Write, 7 | path::PathBuf, 8 | }; 9 | 10 | use ron::de::from_reader; 11 | 12 | fn path(env: &str, s: &str) -> PathBuf { 13 | PathBuf::from(env::var(env).unwrap()).join(s) 14 | } 15 | 16 | fn read_template_index>(p: P) -> Vec { 17 | let mut path = PathBuf::new(); 18 | path.push(p.into()); 19 | path.push("index.ron"); 20 | from_reader(File::open(&path).expect("Failed to open index.ron")) 21 | .expect("Failed to parse template index") 22 | } 23 | 24 | fn main() { 25 | let f = path("CARGO_MANIFEST_DIR", "templates"); 26 | let indices = read_dir(&f).unwrap().map(Result::unwrap).map(|v| { 27 | ( 28 | v.file_name().into_string().unwrap(), 29 | read_template_index(v.path()), 30 | ) 31 | }); 32 | 33 | let mut source_code = String::from( 34 | "use std::collections::HashMap; 35 | 36 | pub fn template_files() -> HashMap<&'static str, Vec<(&'static str, &'static str)>> { 37 | let mut map = HashMap::new(); 38 | ", 39 | ); 40 | for (version, index) in indices { 41 | source_code.push_str(&format!(" map.insert({:?}, ", version)); 42 | source_code.push_str(&index.iter().fold("vec![".to_owned(), |s, file| { 43 | format!( 44 | "{}({:?}, include_str!(concat!(env!(\"CARGO_MANIFEST_DIR\"),\ 45 | concat!(\"/templates/\", concat!(concat!({:?}, \"/\"), {:?}))))), ", 46 | s, file, version, file, 47 | ) 48 | })); 49 | source_code.push_str("]);\n") 50 | } 51 | source_code += " map\n}\n"; 52 | File::create(&path("OUT_DIR", "_template_files.rs")) 53 | .expect("Failed to embed template files") 54 | .write_all(source_code.as_bytes()) 55 | .expect("Failed to write to destination"); 56 | } 57 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | reorder_imports = true 2 | merge_imports = true 3 | -------------------------------------------------------------------------------- /src/error.rs: -------------------------------------------------------------------------------- 1 | error_chain! { 2 | foreign_links { 3 | Io(::std::io::Error) #[doc = "IO error"]; 4 | VersionReq(::semver::ReqParseError) #[doc = "Could not parse version requirements"]; 5 | SemVer(::semver::SemVerError) #[doc = "Could not parse version"]; 6 | } 7 | 8 | errors { 9 | New(name: String) { 10 | description("project creation failed") 11 | display("project creation for project {:?} failed", name) 12 | } 13 | 14 | /// Don't have a template matching this version of the `amethyst` crate 15 | UnsupportedVersion(version: String) { 16 | description("unsupported version of Amethyst requested") 17 | display("This version of amethyst_tools does not support the requested version {:?}", version) 18 | } 19 | 20 | /// Failed to fetch `amethyst` crate version from crates.io 21 | FetchVersionFailure { 22 | description("Failed to fetch latest version of amethyst") 23 | } 24 | 25 | /// The fetched crates.io JSON is not valid 26 | InvalidCratesIoJson { 27 | description("The JSON fetched from crates.io is invalid") 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/fetch.rs: -------------------------------------------------------------------------------- 1 | use serde_json as json; 2 | /// Fetches the latest version of Amethyst by pulling from crates.io 3 | /// Most of this code is based off of cargo-edit's fetch code 4 | use std::time::Duration; 5 | 6 | use crate::error::*; 7 | 8 | const REGISTRY_HOST: &str = "https://crates.io"; 9 | const DEFAULT_TIMEOUT: Duration = Duration::from_secs(5); 10 | 11 | #[derive(Deserialize)] 12 | struct Versions { 13 | versions: Vec, 14 | } 15 | 16 | #[derive(Deserialize)] 17 | struct CrateVersion { 18 | #[serde(rename = "crate")] 19 | _name: String, 20 | #[serde(rename = "num")] 21 | version: semver::Version, 22 | yanked: bool, 23 | } 24 | 25 | /// Returns the latest `amethyst` crate version available. 26 | /// 27 | /// # Errors 28 | /// 29 | /// Returns an error when failing to fetch the `amethyst` version. 30 | pub fn get_latest_version() -> Result { 31 | let crate_versions = fetch_cratesio("/crates/amethyst_tools")?; 32 | let dep = crate_versions 33 | .versions 34 | .iter() 35 | .find(|&v| !v.yanked) 36 | .ok_or(ErrorKind::FetchVersionFailure)? 37 | .version 38 | .to_string(); 39 | Ok(dep) 40 | } 41 | 42 | fn fetch_cratesio(path: &str) -> Result { 43 | let url = format!("{host}/api/v1{path}", host = REGISTRY_HOST, path = path); 44 | let response = 45 | get_with_timeout(&url, DEFAULT_TIMEOUT).chain_err(|| ErrorKind::FetchVersionFailure)?; 46 | let version: Versions = 47 | json::from_reader(response).chain_err(|| ErrorKind::InvalidCratesIoJson)?; 48 | Ok(version) 49 | } 50 | 51 | fn get_with_timeout(url: &str, timeout: Duration) -> reqwest::Result { 52 | let client = reqwest::ClientBuilder::new() 53 | .timeout(timeout) 54 | .proxy(reqwest::Proxy::custom(|url| { 55 | env_proxy::for_url(url).to_url() 56 | })) 57 | .build()?; 58 | client.get(url).send() 59 | } 60 | 61 | #[cfg(test)] 62 | mod tests { 63 | use crate::get_latest_version; 64 | 65 | #[test] 66 | fn test_fetch() { 67 | assert!(get_latest_version().is_ok()); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Amethyst CLI backend. 2 | //! 3 | 4 | #[macro_use] 5 | extern crate error_chain; 6 | #[macro_use] 7 | extern crate serde_derive; 8 | 9 | pub use new::New; 10 | 11 | pub mod error; 12 | pub use fetch::get_latest_version; 13 | mod templates; 14 | 15 | mod fetch; 16 | mod new; 17 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | //! Amethyst CLI binary crate. 2 | //! 3 | 4 | use std::process::exit; 5 | 6 | use amethyst_cli as cli; 7 | use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; 8 | 9 | fn main() { 10 | eprintln!( 11 | "WARNING! amethyst_tools has been deprecated and will stop working in future versions." 12 | ); 13 | eprintln!("For more details please see https://community.amethyst.rs/t/end-of-life-for-amethyst-tools-the-cli/1656"); 14 | let matches = App::new("Amethyst CLI") 15 | .author("Created by Amethyst developers") 16 | .version(env!("CARGO_PKG_VERSION")) 17 | .about("Allows managing Amethyst game projects") 18 | .subcommand( 19 | SubCommand::with_name("new") 20 | .about("Creates a new Amethyst project") 21 | .arg( 22 | Arg::with_name("project_name") 23 | .help("The directory name for the new project") 24 | .required(true), 25 | ) 26 | .arg( 27 | Arg::with_name("amethyst_version") 28 | .short("a") 29 | .long("amethyst") 30 | .value_name("AMETHYST_VERSION") 31 | .takes_value(true) 32 | .help("The requested version of Amethyst"), 33 | ) 34 | .arg( 35 | Arg::with_name("no_defaults") 36 | .short("n") 37 | .long("no-defaults") 38 | .help("Do not autodetect graphics backend into Cargo.toml"), 39 | ), 40 | ) 41 | .subcommand( 42 | SubCommand::with_name("update") 43 | .about("Checks if you can update Amethyst component") 44 | .arg( 45 | Arg::with_name("component_name") 46 | .help("Name of component to try and update") 47 | .value_name("COMPONENT_NAME") 48 | .takes_value(true), 49 | ), 50 | ) 51 | .setting(AppSettings::SubcommandRequiredElseHelp) 52 | .get_matches(); 53 | 54 | match matches.subcommand() { 55 | ("new", Some(args)) => exec_new(args), 56 | ("update", Some(args)) => exec_update(args), 57 | _ => eprintln!("WARNING: subcommand not tested. This is a bug."), 58 | } 59 | } 60 | 61 | fn exec_new(args: &ArgMatches) { 62 | let project_name = args 63 | .value_of("project_name") 64 | .expect("Bug: project_name is required"); 65 | let project_name = project_name.to_owned(); 66 | let version = args.value_of("amethyst_version").map(ToOwned::to_owned); 67 | let no_defaults = args.is_present("no_defaults"); 68 | 69 | let n = cli::New { 70 | project_name, 71 | version, 72 | no_defaults, 73 | }; 74 | 75 | if let Err(e) = n.execute() { 76 | handle_error(&e); 77 | } else { 78 | println!("Project ready!"); 79 | println!("Checking for updates..."); 80 | if let Err(e) = check_version() { 81 | handle_error(&e); 82 | } 83 | } 84 | } 85 | 86 | fn exec_update(args: &ArgMatches) { 87 | // We don't currently support checking anything other than the version of amethyst tools 88 | let _component_name = args.value_of("component_name").map(ToOwned::to_owned); 89 | if let Err(e) = check_version() { 90 | handle_error(&e); 91 | } 92 | exit(0); 93 | } 94 | 95 | // Prints a warning/info message if this version of amethyst_cli is out of date 96 | fn check_version() -> cli::error::Result<()> { 97 | use ansi_term::Color; 98 | use cli::get_latest_version; 99 | 100 | let local_version = semver::Version::parse(env!("CARGO_PKG_VERSION"))?; 101 | let remote_version_str = get_latest_version()?; 102 | let remote_version = semver::Version::parse(&remote_version_str)?; 103 | 104 | if local_version < remote_version { 105 | eprintln!( 106 | "{}: Local version of `amethyst_tools` ({}) is out of date. Latest version is {}", 107 | Color::Yellow.paint("warning"), 108 | env!("CARGO_PKG_VERSION"), 109 | remote_version_str 110 | ); 111 | } else { 112 | println!("No new versions found."); 113 | } 114 | Ok(()) 115 | } 116 | fn handle_error(e: &cli::error::Error) { 117 | use ansi_term::Color; 118 | 119 | eprintln!("{}: {}", Color::Red.paint("error"), e); 120 | 121 | e.iter() 122 | .skip(1) 123 | .for_each(|e| eprintln!("{}: {}", Color::Red.paint("caused by"), e)); 124 | 125 | // Only shown if `RUST_BACKTRACE=1`. 126 | if let Some(backtrace) = e.backtrace() { 127 | eprintln!(); 128 | eprintln!("backtrace: {:?}", backtrace); 129 | } 130 | 131 | exit(1); 132 | } 133 | -------------------------------------------------------------------------------- /src/new.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | fs::{create_dir, remove_dir_all}, 3 | path::Path, 4 | process::Command, 5 | }; 6 | 7 | use crate::{ 8 | error::{ErrorKind, Result, ResultExt}, 9 | templates, 10 | }; 11 | 12 | /// Options for the New subcommand. If `version` is None, then it uses 13 | /// the latest version available 14 | #[derive(Clone, Debug)] 15 | pub struct New { 16 | pub project_name: String, 17 | pub version: Option, 18 | pub no_defaults: bool, 19 | } 20 | 21 | impl New { 22 | /// Creates the project template. 23 | /// 24 | /// # Errors 25 | /// 26 | /// Fails if the project directory already exists, or when failing to create the directory. 27 | pub fn execute(&self) -> Result<()> { 28 | self.execute_inner() 29 | .chain_err(|| ErrorKind::New(self.project_name.clone())) 30 | } 31 | 32 | fn execute_inner(&self) -> Result<()> { 33 | let path = Path::new(&self.project_name); 34 | if path.exists() { 35 | bail!("project directory {:?} already exists", path); 36 | } 37 | create_dir(path).chain_err(|| "could not create project folder")?; 38 | 39 | let mut params = templates::Parameters::new(); 40 | params.insert( 41 | "project_name".into(), 42 | templates::Value::scalar(self.project_name.to_owned()), 43 | ); 44 | 45 | if let Err(err) = templates::deploy("main", &self.version, self.no_defaults, path, ¶ms) 46 | { 47 | remove_dir_all(path).chain_err(|| "could not clean up project folder")?; 48 | Err(err) 49 | } else { 50 | Command::new("git") 51 | .arg("init") 52 | .current_dir(path) 53 | .spawn()? 54 | .try_wait()?; 55 | Ok(()) 56 | } 57 | } 58 | } 59 | 60 | impl Default for New { 61 | #[must_use] 62 | fn default() -> Self { 63 | Self { 64 | project_name: "game".to_owned(), 65 | version: None, 66 | no_defaults: false, 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/templates.rs: -------------------------------------------------------------------------------- 1 | /// Wrapper around the ``liquid`` crate to handle templating. 2 | use liquid::ParserBuilder; 3 | 4 | use std::{ 5 | fs::{create_dir_all, File}, 6 | io::Write, 7 | path::{Path, PathBuf}, 8 | }; 9 | 10 | use crate::error::{Result, ResultExt}; 11 | 12 | pub use liquid::value::{Object as Parameters, Value}; 13 | 14 | mod external { 15 | include!(concat!(env!("OUT_DIR"), "/_template_files.rs")); 16 | } 17 | 18 | const LIQUID_TEMPLATE_EXTENSION: &str = ".gdpu"; 19 | 20 | pub fn deploy( 21 | template: &str, 22 | version: &Option, 23 | no_defaults: bool, 24 | output: &Path, 25 | params: &Parameters, 26 | ) -> Result<()> { 27 | let parser = ParserBuilder::with_liquid().build().unwrap(); 28 | let template_map = external::template_files(); 29 | let template_versions = template_map 30 | .keys() 31 | .map(|v| semver::Version::parse(v).unwrap()); 32 | let version: String = match version { 33 | Some(ref ver) => semver::Version::parse(ver) 34 | .chain_err(|| format!("Could not parse version {}", ver))? 35 | .to_string(), 36 | None => template_versions 37 | .max() 38 | .ok_or("No template available")? 39 | .to_string(), 40 | }; 41 | 42 | let mut params = params.clone(); 43 | params.insert("amethyst_version".into(), Value::scalar(version.clone())); 44 | 45 | if !no_defaults { 46 | #[cfg(target_os = "macos")] 47 | { 48 | params.insert("graphics_backend".into(), Value::scalar("metal")); 49 | } 50 | #[cfg(not(target_os = "macos"))] 51 | { 52 | params.insert("graphics_backend".into(), Value::scalar("vulkan")); 53 | } 54 | } 55 | 56 | let params = ¶ms; 57 | 58 | let template_files = template_map 59 | .get::(&version) 60 | .ok_or_else(|| format!("No template for version {}", version))?; 61 | 62 | for &(path, content) in template_files.iter() { 63 | let mut path = path.to_owned(); 64 | 65 | let is_parsed = path.ends_with(LIQUID_TEMPLATE_EXTENSION); 66 | if is_parsed { 67 | let len = path.len(); 68 | path.truncate(len - LIQUID_TEMPLATE_EXTENSION.len()); 69 | } 70 | 71 | let mut out = if is_parsed { 72 | parser 73 | .parse(content) 74 | .chain_err(|| format!("Could not parse liquid template at {:?}", path))? 75 | .render(params) 76 | .chain_err(|| { 77 | format!( 78 | "Could not render liquid template at {:?} with parameters {:?}", 79 | path, params 80 | ) 81 | })? 82 | } else { 83 | content.to_owned() 84 | }; 85 | 86 | #[cfg(target_os = "windows")] 87 | { 88 | use regex::Regex; 89 | 90 | out = Regex::new("(?P[^\r])\n") 91 | .unwrap() 92 | .replace_all(&out, "$last\r\n") 93 | .to_string(); 94 | } 95 | #[cfg(not(target_os = "windows"))] 96 | { 97 | out = out.replace("\r\n", "\n"); 98 | } 99 | 100 | let path: PathBuf = output 101 | .join(path) 102 | .iter() 103 | .enumerate() 104 | .filter_map(|(_, e)| if e == template { None } else { Some(e) }) 105 | .collect(); 106 | 107 | create_dir_all(path.parent().expect("Path has no parent"))?; 108 | File::create(&path) 109 | .chain_err(|| format!("failed to create file {:?}", &path))? 110 | .write_all(out.as_bytes()) 111 | .chain_err(|| format!("could not write contents to file {:?}", &path))?; 112 | } 113 | 114 | Ok(()) 115 | } 116 | -------------------------------------------------------------------------------- /templates/0.10.0/index.ron: -------------------------------------------------------------------------------- 1 | [ 2 | "main/.gitignore", 3 | "main/Cargo.toml.gdpu", 4 | "main/src/main.rs.gdpu", 5 | "main/resources/display_config.ron.gdpu", 6 | ] 7 | -------------------------------------------------------------------------------- /templates/0.10.0/main/.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | 4 | # Backup files 5 | .DS_Store 6 | thumbs.db 7 | *~ 8 | *.rs.bk 9 | *.swp 10 | -------------------------------------------------------------------------------- /templates/0.10.0/main/Cargo.toml.gdpu: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{ project_name }}" 3 | version = "0.1.0" 4 | authors = [] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | amethyst = "{{ amethyst_version }}" 9 | -------------------------------------------------------------------------------- /templates/0.10.0/main/resources/display_config.ron.gdpu: -------------------------------------------------------------------------------- 1 | ( 2 | title: "{{ project_name }}", 3 | dimensions: None, 4 | max_dimensions: None, 5 | min_dimensions: None, 6 | fullscreen: false, 7 | multisampling: 1, 8 | visibility: true, 9 | vsync: true, 10 | ) 11 | -------------------------------------------------------------------------------- /templates/0.10.0/main/src/main.rs.gdpu: -------------------------------------------------------------------------------- 1 | use amethyst::{ 2 | prelude::*, 3 | renderer::{DisplayConfig, DrawFlat, Pipeline, PosNormTex, RenderBundle, Stage}, 4 | utils::application_root_dir, 5 | }; 6 | 7 | struct Example; 8 | 9 | impl SimpleState for Example {} 10 | 11 | fn main() -> amethyst::Result<()> { 12 | amethyst::start_logger(Default::default()); 13 | 14 | let path = format!( 15 | "{}/resources/display_config.ron", 16 | application_root_dir() 17 | ); 18 | let config = DisplayConfig::load(&path); 19 | 20 | let pipe = Pipeline::build().with_stage( 21 | Stage::with_backbuffer() 22 | .clear_target([0.00196, 0.23726, 0.21765, 1.0], 1.0) 23 | .with_pass(DrawFlat::::new()), 24 | ); 25 | 26 | let game_data = 27 | GameDataBuilder::default().with_bundle(RenderBundle::new(pipe, Some(config)))?; 28 | let mut game = Application::new("./", Example, game_data)?; 29 | 30 | game.run(); 31 | 32 | Ok(()) 33 | } 34 | -------------------------------------------------------------------------------- /templates/0.11.0/index.ron: -------------------------------------------------------------------------------- 1 | [ 2 | "main/.gitignore", 3 | "main/README.md.gdpu", 4 | "main/Cargo.toml.gdpu", 5 | "main/src/main.rs.gdpu", 6 | "main/resources/display_config.ron.gdpu", 7 | ] 8 | -------------------------------------------------------------------------------- /templates/0.11.0/main/.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | 4 | # Backup files 5 | .DS_Store 6 | thumbs.db 7 | *~ 8 | *.rs.bk 9 | *.swp 10 | -------------------------------------------------------------------------------- /templates/0.11.0/main/Cargo.toml.gdpu: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{ project_name }}" 3 | version = "0.1.0" 4 | authors = [] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | amethyst = "{{ amethyst_version }}" 9 | 10 | [features] 11 | empty = ["amethyst/empty"] 12 | metal = ["amethyst/metal"] 13 | vulkan = ["amethyst/vulkan"] 14 | -------------------------------------------------------------------------------- /templates/0.11.0/main/README.md.gdpu: -------------------------------------------------------------------------------- 1 | # {{ project_name }} 2 | 3 | ## How to run 4 | 5 | To run the game, use 6 | 7 | ``` 8 | cargo run --features "vulkan" 9 | ``` 10 | 11 | on Windows and Linux, and 12 | 13 | ``` 14 | cargo run --features "metal" 15 | ``` 16 | 17 | on macOS. 18 | 19 | For building without any graphics backend, you can use 20 | 21 | ``` 22 | cargo run --features "empty" 23 | ``` 24 | 25 | but be aware that as soon as you need any rendering you won't be able to run your game when using 26 | the `empty` feature. 27 | -------------------------------------------------------------------------------- /templates/0.11.0/main/resources/display_config.ron.gdpu: -------------------------------------------------------------------------------- 1 | ( 2 | title: "{{ project_name }}", 3 | dimensions: Some((500, 500)), 4 | ) 5 | -------------------------------------------------------------------------------- /templates/0.11.0/main/src/main.rs.gdpu: -------------------------------------------------------------------------------- 1 | use amethyst::{ 2 | core::transform::TransformBundle, 3 | ecs::prelude::{ReadExpect, Resources, SystemData}, 4 | prelude::*, 5 | renderer::{ 6 | pass::DrawShadedDesc, 7 | rendy::{ 8 | factory::Factory, 9 | graph::{ 10 | render::{RenderGroupDesc, SubpassBuilder}, 11 | GraphBuilder, 12 | }, 13 | hal::{format::Format, image}, 14 | }, 15 | types::DefaultBackend, 16 | GraphCreator, RenderingSystem, 17 | }, 18 | utils::application_root_dir, 19 | window::{ScreenDimensions, Window, WindowBundle}, 20 | }; 21 | 22 | struct MyState; 23 | 24 | impl SimpleState for MyState { 25 | fn on_start(&mut self, _data: StateData<'_, GameData<'_, '_>>) {} 26 | } 27 | 28 | fn main() -> amethyst::Result<()> { 29 | amethyst::start_logger(Default::default()); 30 | 31 | let app_root = application_root_dir()?; 32 | 33 | let resources_dir = app_root.join("resources"); 34 | let display_config_path = resources_dir.join("display_config.ron"); 35 | 36 | let game_data = GameDataBuilder::default() 37 | .with_bundle(WindowBundle::from_config_path(display_config_path))? 38 | .with_bundle(TransformBundle::new())? 39 | .with_thread_local(RenderingSystem::::new( 40 | RenderingGraph::default(), 41 | )); 42 | 43 | let mut game = Application::new(resources_dir, MyState, game_data)?; 44 | game.run(); 45 | 46 | Ok(()) 47 | } 48 | 49 | #[derive(Default)] 50 | struct RenderingGraph { 51 | dimensions: Option, 52 | surface_format: Option, 53 | dirty: bool, 54 | } 55 | 56 | impl GraphCreator for RenderingGraph { 57 | fn rebuild(&mut self, res: &Resources) -> bool { 58 | // Rebuild when dimensions change, but wait until at least two frames have the same. 59 | let new_dimensions = res.try_fetch::(); 60 | use std::ops::Deref; 61 | if self.dimensions.as_ref() != new_dimensions.as_ref().map(|d| d.deref()) { 62 | self.dirty = true; 63 | self.dimensions = new_dimensions.map(|d| d.clone()); 64 | return false; 65 | } 66 | 67 | self.dirty 68 | } 69 | 70 | fn builder( 71 | &mut self, 72 | factory: &mut Factory, 73 | res: &Resources, 74 | ) -> GraphBuilder { 75 | use amethyst::renderer::rendy::{ 76 | graph::present::PresentNode, 77 | hal::command::{ClearDepthStencil, ClearValue}, 78 | }; 79 | 80 | self.dirty = false; 81 | let window = >::fetch(res); 82 | let surface = factory.create_surface(&window); 83 | // cache surface format to speed things up 84 | let surface_format = *self 85 | .surface_format 86 | .get_or_insert_with(|| factory.get_surface_format(&surface)); 87 | let dimensions = self.dimensions.as_ref().unwrap(); 88 | let window_kind = 89 | image::Kind::D2(dimensions.width() as u32, dimensions.height() as u32, 1, 1); 90 | 91 | let mut graph_builder = GraphBuilder::new(); 92 | let color = graph_builder.create_image( 93 | window_kind, 94 | 1, 95 | surface_format, 96 | Some(ClearValue::Color([0.34, 0.36, 0.52, 1.0].into())), 97 | ); 98 | 99 | let depth = graph_builder.create_image( 100 | window_kind, 101 | 1, 102 | Format::D32Sfloat, 103 | Some(ClearValue::DepthStencil(ClearDepthStencil(1.0, 0))), 104 | ); 105 | 106 | let opaque = graph_builder.add_node( 107 | SubpassBuilder::new() 108 | .with_group(DrawShadedDesc::new().builder()) 109 | .with_color(color) 110 | .with_depth_stencil(depth) 111 | .into_pass(), 112 | ); 113 | 114 | let _present = graph_builder 115 | .add_node(PresentNode::builder(factory, surface, color).with_dependency(opaque)); 116 | 117 | graph_builder 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /templates/0.12.0/index.ron: -------------------------------------------------------------------------------- 1 | [ 2 | "main/.gitignore", 3 | "main/README.md.gdpu", 4 | "main/Cargo.toml.gdpu", 5 | "main/src/main.rs.gdpu", 6 | "main/config/display.ron.gdpu", 7 | ] 8 | -------------------------------------------------------------------------------- /templates/0.12.0/main/.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | 4 | # Backup files 5 | .DS_Store 6 | thumbs.db 7 | *~ 8 | *.rs.bk 9 | *.swp 10 | -------------------------------------------------------------------------------- /templates/0.12.0/main/Cargo.toml.gdpu: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{ project_name }}" 3 | version = "0.1.0" 4 | authors = [] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | amethyst = "{{ amethyst_version }}" 9 | 10 | [features] 11 | {% if graphics_backend -%} 12 | # This sets default graphics backend for your project, it was automatically detected based 13 | # on your operating system. It's a great starting point into your journey with amethyst, 14 | # but if you wish to share this with other people, you may wan to consider removing it 15 | # and appending `--feature {{ graphics_backend }}` to your commands, letting people on 16 | # different platforms to chose different ones. 17 | # Alternatively you can leave the default on, and other users can still disable it by 18 | # adding `--no-default-features` to their commands, followed by `--feature` of their choice. 19 | # 20 | # To read more about it, check out documentation available at: 21 | # https://book.amethyst.rs/stable/appendices/c_feature_gates.html?highlight=vulkan#graphics-features 22 | default = ["{{ graphics_backend }}"] 23 | {% endif -%} 24 | empty = ["amethyst/empty"] 25 | metal = ["amethyst/metal"] 26 | vulkan = ["amethyst/vulkan"] 27 | -------------------------------------------------------------------------------- /templates/0.12.0/main/README.md.gdpu: -------------------------------------------------------------------------------- 1 | # {{ project_name }} 2 | 3 | ## How to run 4 | 5 | To run the game, use 6 | 7 | ``` 8 | cargo run --features "vulkan" 9 | ``` 10 | 11 | on Windows and Linux, and 12 | 13 | ``` 14 | cargo run --features "metal" 15 | ``` 16 | 17 | on macOS. 18 | 19 | For building without any graphics backend, you can use 20 | 21 | ``` 22 | cargo run --features "empty" 23 | ``` 24 | 25 | but be aware that as soon as you need any rendering you won't be able to run your game when using 26 | the `empty` feature. 27 | -------------------------------------------------------------------------------- /templates/0.12.0/main/config/display.ron.gdpu: -------------------------------------------------------------------------------- 1 | ( 2 | title: "{{ project_name }}", 3 | dimensions: Some((500, 500)), 4 | ) 5 | -------------------------------------------------------------------------------- /templates/0.12.0/main/src/main.rs.gdpu: -------------------------------------------------------------------------------- 1 | use amethyst::{ 2 | core::transform::TransformBundle, 3 | ecs::prelude::{ReadExpect, Resources, SystemData}, 4 | prelude::*, 5 | renderer::{ 6 | plugins::{RenderFlat2D, RenderToWindow}, 7 | types::DefaultBackend, 8 | RenderingBundle, 9 | }, 10 | utils::application_root_dir, 11 | }; 12 | 13 | struct MyState; 14 | 15 | impl SimpleState for MyState { 16 | fn on_start(&mut self, _data: StateData<'_, GameData<'_, '_>>) {} 17 | } 18 | 19 | fn main() -> amethyst::Result<()> { 20 | amethyst::start_logger(Default::default()); 21 | 22 | let app_root = application_root_dir()?; 23 | 24 | let config_dir = app_root.join("config"); 25 | let display_config_path = config_dir.join("display.ron"); 26 | 27 | let game_data = GameDataBuilder::default() 28 | .with_bundle( 29 | RenderingBundle::::new() 30 | .with_plugin( 31 | RenderToWindow::from_config_path(display_config_path) 32 | .with_clear([0.34, 0.36, 0.52, 1.0]), 33 | ) 34 | .with_plugin(RenderFlat2D::default()), 35 | )? 36 | .with_bundle(TransformBundle::new())?; 37 | 38 | let mut game = Application::new(app_root.join("assets"), MyState, game_data)?; 39 | game.run(); 40 | 41 | Ok(()) 42 | } 43 | -------------------------------------------------------------------------------- /templates/0.13.2/index.ron: -------------------------------------------------------------------------------- 1 | [ 2 | "main/.gitignore", 3 | "main/README.md.gdpu", 4 | "main/Cargo.toml.gdpu", 5 | "main/src/main.rs.gdpu", 6 | "main/config/display.ron.gdpu", 7 | "main/assets/.gitkeep", 8 | ] 9 | -------------------------------------------------------------------------------- /templates/0.13.2/main/.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | 4 | # Backup files 5 | .DS_Store 6 | thumbs.db 7 | *~ 8 | *.rs.bk 9 | *.swp 10 | -------------------------------------------------------------------------------- /templates/0.13.2/main/Cargo.toml.gdpu: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{ project_name }}" 3 | version = "0.1.0" 4 | authors = [] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | amethyst = "{{ amethyst_version }}" 9 | 10 | [features] 11 | default = ["{{ graphics_backend }}"] 12 | empty = ["amethyst/empty"] 13 | metal = ["amethyst/metal"] 14 | vulkan = ["amethyst/vulkan"] 15 | -------------------------------------------------------------------------------- /templates/0.13.2/main/README.md.gdpu: -------------------------------------------------------------------------------- 1 | # {{ project_name }} 2 | 3 | ## How to run 4 | 5 | To run the game, use 6 | 7 | ``` 8 | cargo run --features "vulkan" 9 | ``` 10 | 11 | on Windows and Linux, and 12 | 13 | ``` 14 | cargo run --features "metal" 15 | ``` 16 | 17 | on macOS. 18 | 19 | For building without any graphics backend, you can use 20 | 21 | ``` 22 | cargo run --features "empty" 23 | ``` 24 | 25 | but be aware that as soon as you need any rendering you won't be able to run your game when using 26 | the `empty` feature. 27 | -------------------------------------------------------------------------------- /templates/0.13.2/main/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amethyst/tools/079171510c7d6a09eda43d2193949c5d436ce063/templates/0.13.2/main/assets/.gitkeep -------------------------------------------------------------------------------- /templates/0.13.2/main/config/display.ron.gdpu: -------------------------------------------------------------------------------- 1 | ( 2 | title: "{{ project_name }}", 3 | dimensions: Some((500, 500)), 4 | ) 5 | -------------------------------------------------------------------------------- /templates/0.13.2/main/src/main.rs.gdpu: -------------------------------------------------------------------------------- 1 | use amethyst::{ 2 | core::transform::TransformBundle, 3 | prelude::*, 4 | renderer::{ 5 | plugins::{RenderFlat2D, RenderToWindow}, 6 | types::DefaultBackend, 7 | RenderingBundle, 8 | }, 9 | utils::application_root_dir, 10 | }; 11 | 12 | struct MyState; 13 | 14 | impl SimpleState for MyState { 15 | fn on_start(&mut self, _data: StateData<'_, GameData<'_, '_>>) {} 16 | } 17 | 18 | fn main() -> amethyst::Result<()> { 19 | amethyst::start_logger(Default::default()); 20 | 21 | let app_root = application_root_dir()?; 22 | 23 | let config_dir = app_root.join("config"); 24 | let display_config_path = config_dir.join("display.ron"); 25 | 26 | let game_data = GameDataBuilder::default() 27 | .with_bundle( 28 | RenderingBundle::::new() 29 | .with_plugin( 30 | RenderToWindow::from_config_path(display_config_path) 31 | .with_clear([0.34, 0.36, 0.52, 1.0]), 32 | ) 33 | .with_plugin(RenderFlat2D::default()), 34 | )? 35 | .with_bundle(TransformBundle::new())?; 36 | 37 | let mut game = Application::new(app_root.join("assets"), MyState, game_data)?; 38 | game.run(); 39 | 40 | Ok(()) 41 | } 42 | -------------------------------------------------------------------------------- /templates/0.14.0/index.ron: -------------------------------------------------------------------------------- 1 | [ 2 | "main/.gitignore", 3 | "main/README.md.gdpu", 4 | "main/Cargo.toml.gdpu", 5 | "main/src/main.rs.gdpu", 6 | "main/config/display.ron.gdpu", 7 | "main/assets/.gitkeep" 8 | ] 9 | -------------------------------------------------------------------------------- /templates/0.14.0/main/.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | 4 | # Backup files 5 | .DS_Store 6 | thumbs.db 7 | *~ 8 | *.rs.bk 9 | *.swp 10 | -------------------------------------------------------------------------------- /templates/0.14.0/main/Cargo.toml.gdpu: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{ project_name }}" 3 | version = "0.1.0" 4 | authors = [] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | amethyst = "{{ amethyst_version }}" 9 | 10 | [features] 11 | default = ["{{ graphics_backend }}"] 12 | empty = ["amethyst/empty"] 13 | metal = ["amethyst/metal"] 14 | vulkan = ["amethyst/vulkan"] 15 | -------------------------------------------------------------------------------- /templates/0.14.0/main/README.md.gdpu: -------------------------------------------------------------------------------- 1 | # {{ project_name }} 2 | 3 | ## How to run 4 | 5 | To run the game, use 6 | 7 | ``` 8 | cargo run --features "vulkan" 9 | ``` 10 | 11 | on Windows and Linux, and 12 | 13 | ``` 14 | cargo run --features "metal" 15 | ``` 16 | 17 | on macOS. 18 | 19 | For building without any graphics backend, you can use 20 | 21 | ``` 22 | cargo run --features "empty" 23 | ``` 24 | 25 | but be aware that as soon as you need any rendering you won't be able to run your game when using 26 | the `empty` feature. 27 | -------------------------------------------------------------------------------- /templates/0.14.0/main/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amethyst/tools/079171510c7d6a09eda43d2193949c5d436ce063/templates/0.14.0/main/assets/.gitkeep -------------------------------------------------------------------------------- /templates/0.14.0/main/config/display.ron.gdpu: -------------------------------------------------------------------------------- 1 | ( 2 | title: "{{ project_name }}", 3 | dimensions: Some((500, 500)), 4 | ) 5 | -------------------------------------------------------------------------------- /templates/0.14.0/main/src/main.rs.gdpu: -------------------------------------------------------------------------------- 1 | use amethyst::{ 2 | core::transform::TransformBundle, 3 | prelude::*, 4 | renderer::{ 5 | plugins::{RenderFlat2D, RenderToWindow}, 6 | types::DefaultBackend, 7 | RenderingBundle, 8 | }, 9 | utils::application_root_dir, 10 | }; 11 | 12 | struct MyState; 13 | 14 | impl SimpleState for MyState { 15 | fn on_start(&mut self, _data: StateData<'_, GameData<'_, '_>>) {} 16 | } 17 | 18 | fn main() -> amethyst::Result<()> { 19 | amethyst::start_logger(Default::default()); 20 | 21 | let app_root = application_root_dir()?; 22 | 23 | let assets_dir = app_root.join("assets"); 24 | let config_dir = app_root.join("config"); 25 | let display_config_path = config_dir.join("display.ron"); 26 | 27 | let game_data = GameDataBuilder::default() 28 | .with_bundle( 29 | RenderingBundle::::new() 30 | .with_plugin( 31 | RenderToWindow::from_config_path(display_config_path) 32 | .unwrap() 33 | .with_clear([0.34, 0.36, 0.52, 1.0]), 34 | ) 35 | .with_plugin(RenderFlat2D::default()), 36 | )? 37 | .with_bundle(TransformBundle::new())?; 38 | 39 | let mut game = Application::new(assets_dir, MyState, game_data)?; 40 | game.run(); 41 | 42 | Ok(()) 43 | } 44 | -------------------------------------------------------------------------------- /templates/0.15.0/index.ron: -------------------------------------------------------------------------------- 1 | [ 2 | "main/.gitignore", 3 | "main/README.md.gdpu", 4 | "main/Cargo.toml.gdpu", 5 | "main/src/main.rs.gdpu", 6 | "main/config/display.ron.gdpu", 7 | "main/assets/.gitkeep" 8 | ] 9 | -------------------------------------------------------------------------------- /templates/0.15.0/main/.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | 4 | # Backup files 5 | .DS_Store 6 | thumbs.db 7 | *~ 8 | *.rs.bk 9 | *.swp 10 | -------------------------------------------------------------------------------- /templates/0.15.0/main/Cargo.toml.gdpu: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{ project_name }}" 3 | version = "0.1.0" 4 | authors = [] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | amethyst = "{{ amethyst_version }}" 9 | 10 | [features] 11 | default = ["{{ graphics_backend }}"] 12 | empty = ["amethyst/empty"] 13 | metal = ["amethyst/metal"] 14 | vulkan = ["amethyst/vulkan"] 15 | -------------------------------------------------------------------------------- /templates/0.15.0/main/README.md.gdpu: -------------------------------------------------------------------------------- 1 | # {{ project_name }} 2 | 3 | ## How to run 4 | 5 | To run the game, run the following command, which defaults to the `{{ graphics_backend }}` graphics backend: 6 | 7 | ```bash 8 | cargo run 9 | ``` 10 | 11 | Windows and Linux users may explicitly choose `"vulkan"` with the following command: 12 | 13 | ```bash 14 | cargo run --no-default-features --features "vulkan" 15 | ``` 16 | 17 | Mac OS X users may explicitly choose `"metal"` with the following command: 18 | 19 | ```bash 20 | cargo run --no-default-features --features "metal" 21 | ``` 22 | -------------------------------------------------------------------------------- /templates/0.15.0/main/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amethyst/tools/079171510c7d6a09eda43d2193949c5d436ce063/templates/0.15.0/main/assets/.gitkeep -------------------------------------------------------------------------------- /templates/0.15.0/main/config/display.ron.gdpu: -------------------------------------------------------------------------------- 1 | ( 2 | title: "{{ project_name }}", 3 | dimensions: Some((500, 500)), 4 | ) 5 | -------------------------------------------------------------------------------- /templates/0.15.0/main/src/main.rs.gdpu: -------------------------------------------------------------------------------- 1 | use amethyst::{ 2 | core::transform::TransformBundle, 3 | prelude::*, 4 | renderer::{ 5 | plugins::{RenderFlat2D, RenderToWindow}, 6 | types::DefaultBackend, 7 | RenderingBundle, 8 | }, 9 | utils::application_root_dir, 10 | }; 11 | 12 | struct MyState; 13 | 14 | impl SimpleState for MyState { 15 | fn on_start(&mut self, _data: StateData<'_, GameData<'_, '_>>) {} 16 | } 17 | 18 | fn main() -> amethyst::Result<()> { 19 | amethyst::start_logger(Default::default()); 20 | 21 | let app_root = application_root_dir()?; 22 | 23 | let assets_dir = app_root.join("assets"); 24 | let config_dir = app_root.join("config"); 25 | let display_config_path = config_dir.join("display.ron"); 26 | 27 | let game_data = GameDataBuilder::default() 28 | .with_bundle( 29 | RenderingBundle::::new() 30 | .with_plugin( 31 | RenderToWindow::from_config_path(display_config_path)? 32 | .with_clear([0.34, 0.36, 0.52, 1.0]), 33 | ) 34 | .with_plugin(RenderFlat2D::default()), 35 | )? 36 | .with_bundle(TransformBundle::new())?; 37 | 38 | let mut game = Application::new(assets_dir, MyState, game_data)?; 39 | game.run(); 40 | 41 | Ok(()) 42 | } 43 | -------------------------------------------------------------------------------- /templates/0.6.0/index.ron: -------------------------------------------------------------------------------- 1 | [ 2 | "main/.gitignore", 3 | "main/Cargo.toml.gdpu", 4 | "main/src/main.rs.gdpu", 5 | "main/resources/display_config.ron.gdpu", 6 | ] 7 | -------------------------------------------------------------------------------- /templates/0.6.0/main/.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | 4 | # Backup files 5 | .DS_Store 6 | thumbs.db 7 | *~ 8 | *.rs.bk 9 | *.swp 10 | -------------------------------------------------------------------------------- /templates/0.6.0/main/Cargo.toml.gdpu: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{ project_name }}" 3 | version = "0.1.0" 4 | authors = [] 5 | 6 | [dependencies] 7 | amethyst = "{{ amethyst_version }}" 8 | -------------------------------------------------------------------------------- /templates/0.6.0/main/resources/display_config.ron.gdpu: -------------------------------------------------------------------------------- 1 | ( 2 | title: "{{ project_name }}", 3 | dimensions: None, 4 | max_dimensions: None, 5 | min_dimensions: None, 6 | fullscreen: false, 7 | multisampling: 1, 8 | visibility: true, 9 | vsync: true, 10 | ) 11 | -------------------------------------------------------------------------------- /templates/0.6.0/main/src/main.rs.gdpu: -------------------------------------------------------------------------------- 1 | extern crate amethyst; 2 | 3 | use amethyst::prelude::*; 4 | use amethyst::renderer::{DisplayConfig, DrawFlat, Event, KeyboardInput, Pipeline, PosNormTex, 5 | RenderBundle, RenderSystem, Stage, VirtualKeyCode, WindowEvent}; 6 | 7 | struct Example; 8 | 9 | impl State for Example { 10 | fn handle_event(&mut self, _: &mut World, event: Event) -> Trans { 11 | match event { 12 | Event::WindowEvent { event, .. } => match event { 13 | WindowEvent::KeyboardInput { 14 | input: 15 | KeyboardInput { 16 | virtual_keycode: Some(VirtualKeyCode::Escape), 17 | .. 18 | }, 19 | .. 20 | } => Trans::Quit, 21 | _ => Trans::None, 22 | }, 23 | _ => Trans::None, 24 | } 25 | } 26 | } 27 | 28 | fn run() -> Result<(), amethyst::Error> { 29 | let path = format!( 30 | "{}/resources/display_config.ron", 31 | env!("CARGO_MANIFEST_DIR") 32 | ); 33 | let config = DisplayConfig::load(&path); 34 | 35 | let pipe = Pipeline::build().with_stage( 36 | Stage::with_backbuffer() 37 | .clear_target([0.00196, 0.23726, 0.21765, 1.0], 1.0) 38 | .with_pass(DrawFlat::::new()), 39 | ); 40 | 41 | let mut game = Application::build("./", Example)? 42 | .with_bundle(RenderBundle::new())? 43 | .with_local(RenderSystem::build(pipe, Some(config))?) 44 | .build() 45 | .expect("Fatal error"); 46 | 47 | game.run(); 48 | 49 | Ok(()) 50 | } 51 | 52 | fn main() { 53 | if let Err(e) = run() { 54 | println!("Error occurred during game execution: {}", e); 55 | ::std::process::exit(1); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /templates/0.7.0/index.ron: -------------------------------------------------------------------------------- 1 | [ 2 | "main/.gitignore", 3 | "main/Cargo.toml.gdpu", 4 | "main/src/main.rs.gdpu", 5 | "main/resources/display_config.ron.gdpu", 6 | ] 7 | -------------------------------------------------------------------------------- /templates/0.7.0/main/.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | 4 | # Backup files 5 | .DS_Store 6 | thumbs.db 7 | *~ 8 | *.rs.bk 9 | *.swp 10 | -------------------------------------------------------------------------------- /templates/0.7.0/main/Cargo.toml.gdpu: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{ project_name }}" 3 | version = "0.1.0" 4 | authors = [] 5 | 6 | [dependencies] 7 | amethyst = "{{ amethyst_version }}" 8 | -------------------------------------------------------------------------------- /templates/0.7.0/main/resources/display_config.ron.gdpu: -------------------------------------------------------------------------------- 1 | ( 2 | title: "{{ project_name }}", 3 | dimensions: None, 4 | max_dimensions: None, 5 | min_dimensions: None, 6 | fullscreen: false, 7 | multisampling: 1, 8 | visibility: true, 9 | vsync: true, 10 | ) 11 | -------------------------------------------------------------------------------- /templates/0.7.0/main/src/main.rs.gdpu: -------------------------------------------------------------------------------- 1 | extern crate amethyst; 2 | 3 | use amethyst::prelude::*; 4 | use amethyst::renderer::{DisplayConfig, DrawFlat, Event, KeyboardInput, Pipeline, PosNormTex, 5 | RenderBundle, Stage, VirtualKeyCode, WindowEvent}; 6 | 7 | struct Example; 8 | 9 | impl<'a, 'b> State> for Example { 10 | fn handle_event(&mut self, _: StateData, event: Event) -> Trans> { 11 | match event { 12 | Event::WindowEvent { event, .. } => match event { 13 | WindowEvent::KeyboardInput { 14 | input: 15 | KeyboardInput { 16 | virtual_keycode: Some(VirtualKeyCode::Escape), 17 | .. 18 | }, 19 | .. 20 | } => Trans::Quit, 21 | _ => Trans::None, 22 | }, 23 | _ => Trans::None, 24 | } 25 | } 26 | 27 | fn update(&mut self, data: StateData) -> Trans> { 28 | data.data.update(&data.world); 29 | Trans::None 30 | } 31 | } 32 | 33 | fn main() -> amethyst::Result<()> { 34 | let path = format!( 35 | "{}/resources/display_config.ron", 36 | env!("CARGO_MANIFEST_DIR") 37 | ); 38 | let config = DisplayConfig::load(&path); 39 | 40 | let pipe = Pipeline::build().with_stage( 41 | Stage::with_backbuffer() 42 | .clear_target([0.00196, 0.23726, 0.21765, 1.0], 1.0) 43 | .with_pass(DrawFlat::::new()), 44 | ); 45 | 46 | let game_data = GameDataBuilder::default() 47 | .with_bundle(RenderBundle::new(pipe, Some(config)))?; 48 | let mut game = Application::build("./", Example)? 49 | .build(game_data)?; 50 | game.run(); 51 | Ok(()) 52 | } 53 | -------------------------------------------------------------------------------- /templates/0.8.0/index.ron: -------------------------------------------------------------------------------- 1 | [ 2 | "main/.gitignore", 3 | "main/Cargo.toml.gdpu", 4 | "main/src/main.rs.gdpu", 5 | "main/resources/display_config.ron.gdpu", 6 | ] 7 | -------------------------------------------------------------------------------- /templates/0.8.0/main/.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | 4 | # Backup files 5 | .DS_Store 6 | thumbs.db 7 | *~ 8 | *.rs.bk 9 | *.swp 10 | -------------------------------------------------------------------------------- /templates/0.8.0/main/Cargo.toml.gdpu: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{ project_name }}" 3 | version = "0.1.0" 4 | authors = [] 5 | 6 | [dependencies] 7 | amethyst = "{{ amethyst_version }}" 8 | -------------------------------------------------------------------------------- /templates/0.8.0/main/resources/display_config.ron.gdpu: -------------------------------------------------------------------------------- 1 | ( 2 | title: "{{ project_name }}", 3 | dimensions: None, 4 | max_dimensions: None, 5 | min_dimensions: None, 6 | fullscreen: false, 7 | multisampling: 1, 8 | visibility: true, 9 | vsync: true, 10 | ) 11 | -------------------------------------------------------------------------------- /templates/0.8.0/main/src/main.rs.gdpu: -------------------------------------------------------------------------------- 1 | extern crate amethyst; 2 | 3 | use amethyst::prelude::*; 4 | use amethyst::input::{is_close_requested, is_key_down}; 5 | use amethyst::renderer::{DisplayConfig, DrawFlat, Event, Pipeline, PosNormTex, 6 | RenderBundle, Stage, VirtualKeyCode}; 7 | 8 | struct Example; 9 | 10 | impl<'a, 'b> State> for Example { 11 | fn handle_event(&mut self, _: StateData, event: Event) -> Trans> { 12 | if is_close_requested(&event) || is_key_down(&event, VirtualKeyCode::Escape) { 13 | Trans::Quit 14 | } else { 15 | Trans::None 16 | } 17 | } 18 | 19 | fn update(&mut self, data: StateData) -> Trans> { 20 | data.data.update(&data.world); 21 | Trans::None 22 | } 23 | } 24 | 25 | fn main() -> Result<(), amethyst::Error> { 26 | amethyst::start_logger(Default::default()); 27 | 28 | let path = format!( 29 | "{}/resources/display_config.ron", 30 | env!("CARGO_MANIFEST_DIR") 31 | ); 32 | let config = DisplayConfig::load(&path); 33 | 34 | let pipe = Pipeline::build().with_stage( 35 | Stage::with_backbuffer() 36 | .clear_target([0.00196, 0.23726, 0.21765, 1.0], 1.0) 37 | .with_pass(DrawFlat::::new()), 38 | ); 39 | 40 | let game_data = GameDataBuilder::default() 41 | .with_bundle(RenderBundle::new(pipe, Some(config)))?; 42 | let mut game = Application::build("./", Example)? 43 | .build(game_data)?; 44 | game.run(); 45 | Ok(()) 46 | } 47 | -------------------------------------------------------------------------------- /templates/0.9.0/index.ron: -------------------------------------------------------------------------------- 1 | [ 2 | "main/.gitignore", 3 | "main/Cargo.toml.gdpu", 4 | "main/src/main.rs.gdpu", 5 | "main/resources/display_config.ron.gdpu", 6 | ] 7 | -------------------------------------------------------------------------------- /templates/0.9.0/main/.gitignore: -------------------------------------------------------------------------------- 1 | # Unwanted files 2 | target 3 | 4 | # Backup files 5 | .DS_Store 6 | thumbs.db 7 | *~ 8 | *.rs.bk 9 | *.swp 10 | -------------------------------------------------------------------------------- /templates/0.9.0/main/Cargo.toml.gdpu: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "{{ project_name }}" 3 | version = "0.1.0" 4 | authors = [] 5 | 6 | [dependencies] 7 | amethyst = "{{ amethyst_version }}" 8 | -------------------------------------------------------------------------------- /templates/0.9.0/main/resources/display_config.ron.gdpu: -------------------------------------------------------------------------------- 1 | ( 2 | title: "{{ project_name }}", 3 | dimensions: None, 4 | max_dimensions: None, 5 | min_dimensions: None, 6 | fullscreen: false, 7 | multisampling: 1, 8 | visibility: true, 9 | vsync: true, 10 | ) 11 | -------------------------------------------------------------------------------- /templates/0.9.0/main/src/main.rs.gdpu: -------------------------------------------------------------------------------- 1 | extern crate amethyst; 2 | 3 | use amethyst::{ 4 | prelude::*, 5 | renderer::{DisplayConfig, DrawFlat, Pipeline, PosNormTex, RenderBundle, Stage}, 6 | utils::application_root_dir, 7 | }; 8 | 9 | struct Example; 10 | 11 | impl<'a, 'b> SimpleState<'a, 'b> for Example {} 12 | 13 | fn main() -> amethyst::Result<()> { 14 | amethyst::start_logger(Default::default()); 15 | 16 | let path = format!( 17 | "{}/resources/display_config.ron", 18 | application_root_dir() 19 | ); 20 | let config = DisplayConfig::load(&path); 21 | 22 | let pipe = Pipeline::build().with_stage( 23 | Stage::with_backbuffer() 24 | .clear_target([0.00196, 0.23726, 0.21765, 1.0], 1.0) 25 | .with_pass(DrawFlat::::new()), 26 | ); 27 | 28 | let game_data = 29 | GameDataBuilder::default().with_bundle(RenderBundle::new(pipe, Some(config)))?; 30 | let mut game = Application::new("./", Example, game_data)?; 31 | 32 | game.run(); 33 | 34 | Ok(()) 35 | } 36 | -------------------------------------------------------------------------------- /tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/amethyst/tools/079171510c7d6a09eda43d2193949c5d436ce063/tests/.gitkeep --------------------------------------------------------------------------------