Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taurr/bevy-template-rs
Cargo-generate template for Bevy projects
https://github.com/taurr/bevy-template-rs
bevy cargo-generate rust template
Last synced: 2 months ago
JSON representation
Cargo-generate template for Bevy projects
- Host: GitHub
- URL: https://github.com/taurr/bevy-template-rs
- Owner: taurr
- License: apache-2.0
- Created: 2022-01-01T20:59:34.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-20T20:34:47.000Z (about 2 years ago)
- Last Synced: 2024-07-30T17:22:28.513Z (5 months ago)
- Topics: bevy, cargo-generate, rust, template
- Language: Rust
- Homepage:
- Size: 560 KB
- Stars: 25
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-APACHE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Bevy-template-rs
This is a small but feature rich set of [cargo-generate] templates for use when creating [Bevy] applications.
## Templates/Features
- **Binary template for the main game binary.**
- Complete with camera setup, a very small 2D or 3D system and debug diagnostics.
- Includes integration test support - Small test with Bevy in headless mode.
- Optionally includes setup of [vscode tasks].
- Cargo runner configured to use [WASM Server Runner] in case of WASM target (`wasm32-unknown-unknown`)
- Starting the WASM development server using the optional [vscode tasks] uses [cargo-watch].
- Will utilize *fast compiles* as described in [The Bevy Book] when built using the [vscode tasks] (*not for WASM target*).
- if not using [vscode], just use `cargo build --features bevy/dynamic`.
- If enabling the feature `inspector`, the project will attempt to use [bevy-inspector-egui] (works with WASM).
- If enabling the feature `editor`, the project will attempt to use [bevy_editor_pls].
- WASM target goes fullscreen (or rather window)
- Adjusts if expanded inside a existing cargo project.- **Library template for a small library crate.**
- Includes integration test support - Small test with Bevy in headless mode.
- Optionally includes setup of [vscode tasks].
- Adjusts if expanded inside a existing cargo project.- **Minimal template**
- Minimal application template. Really only the basics for a project (Though still with WASM support).- **Workflow template.**
- Add a copy of the [Official Bevy Workflow template] to an existing project.
- Template requires [cargo-generate] to be invoked with the `--init` parameter as it is *not inteded as a complete project*. The template must be expanded inside an existing project.## Usage
To expand e.g a binary project, use:
```shell
cargo generate taurr/bevy-template-rs Binary
```To include Github workflow files, use:
```shell
cd
cargo generate taurr/bevy-template-rs Workflow --init --name
```Why the `--init` parameter? Well thats just to tell [cargo-generate] *not* to create a folder for the generated files.
For further usage, or if having issues with `cargo-generate`, please have a look in the [cargo-generate book](https://cargo-generate.github.io/cargo-generate/index.html).
![Template expansion](./assets/template-expansion.gif)
## Requirements
[cargo-generate] must be installed. The easiest way to do this is:
```shell
cargo install cargo-generate
```## :bulb: Tips'n'tricks
If the template is used on a regular basis, [cargo-generate] allows to setup favorite templates and default variables.
To do this, open or create the file `$CARGO_HOME/cargo-generate.toml`, insert this:
```toml
[values]
gh_username = ""
ide = "vscode|none"[favorites.bevy-bin]
git = "https://github.com/taurr/bevy-template-rs"
subfolder = "Binary"[favorites.bevy-lib]
git = "https://github.com/taurr/bevy-template-rs"
subfolder = "Library"[favorites.bevy-wf]
git = "https://github.com/taurr/bevy-template-rs"
subfolder = "Workflow"
is_init = true
```After this, the template can be expanded using `cargo generate bevy-bin`, `cargo generate bevy-lib` or `cargo generate bevy-wf`.
:warning: Adding the workflow template through this favorite will no longer require the `--init` parameter, and thus will always expand in the current directory!
[Bevy]:https://bevyengine.org
[cargo-generate]:https://github.com/cargo-generate/cargo-generate
[bevy_editor_pls]:https://github.com/jakobhellermann/bevy_editor_pls
[The Bevy Book]:https://bevyengine.org/learn/book
[Official Bevy Workflow template]:https://github.com/bevyengine/bevy_github_ci_template
[WASM Server Runner]: https://github.com/jakobhellermann/wasm-server-runner
[vscode]: https://code.visualstudio.com
[vscode tasks]: https://code.visualstudio.com/Docs/editor/tasks
[cargo-watch]: https://github.com/watchexec/cargo-watch