This is the Leafwing Studios' template repo, providing a quick, opinionated base for high-quality Bevy game projects (and libraries). We've shaved the yaks for you!
The licenses here are provided for template purposes: this repository itself is provided under MIT-0. Feel free to use, hack and adopt this freely: no attribution needed.
Use this template by pressing the big green "Use this template" button in the top right corner of this repo to create a new repository.
This repository has dynamic linking enabled for much faster incremental compile times.
If you're on Windows, you'll need to use the nightly
Rust compiler.
Swap by using rustup default nightly
.
You may want to run rustup update
afterwards to get your tools up to date.
If you are making a game:
Cargo.toml
.examples
folder.lib.rs
(and other files that are pulled in from it).
Then, add all of the plugins and build your App
in main.rs
.nightly
, remove stable
from the toolchain
field in .github/workflows/ci.yml
.If you are making a standalone library:
main.rs
and the [[bin]]
section of the top-level Cargo.toml
.bevy
features: change default-features
to false
and disable the dynamic
feature. This avoids unnecessarily pulling in extra features for your users.Finally:
Cargo.toml
(and all imports to ensure your code compiles).About
, Getting Started
and other sections as needed..github
folder to better match your needs.Use cargo run
.
This repo is set up to always build with full optimizations, so there's no need for a --release
flag in most cases.
Dynamic linking is enabled to ensure build times stay snappy.
To run an example, use cargo run --example_name
, where example_name
is the file name of the example without the .rs
extension.
A build will be produced for Windows, MacOS and Linux each time a tag is pushed to GitHub.
These can be found under the Releases tab of your project.
See CONTRIBUTING.md!
#
to hide a setup line from the doc tests.#[cfg(test)]
on the test module to ignore it during builds, and #[test]
on the test functions to ensure they are run.tests
folder, importing functions from lib.rs
.Use cargo test
to run all tests.
The CI will:
cargo fmt
.clippy
lints pass.Check this locally with:
cargo run -p ci
cargo test --workspace
To manually rerun CI:
Actions
tab.Reference documentation is handled with standard Rust doc strings.
Use cargo doc --open
to build and then open the docs.
Design docs (or other book-format documentation) is handled with mdBook.
Install it with cargo install mdbook
, then use mdbook serve --open
to launch the docs.
To run the benchmarks, use cargo bench
.
For more documentation on making your own benchmarks, check out criterion's docs.