direnv allow
cargo build --all
cargo run -p brain-engine-bin
# Test the library
cargo test -p brain-engine-core
# Test everything
cargo test --all
Add to your Cargo.toml
:
[dependencies]
brain-engine-core = { path = "../bevy-starter/brain-engine-core" }
Then in your code:
use brain_engine_core::{Map, TileGeneratorDefault};
let generator = TileGeneratorDefault::new();
let map = Map::new(10, generator);
The library is in brain-engine-core/
. Changes here are immediately available to brain-engine-bin
and any other local projects that depend on it.
The game is in brain-engine-bin/
. It imports the library with:
use brain_engine_core::{Map, TileGeneratorDefault};
Implement the TileGenerator
trait in brain-engine-core
:
use brain_engine_core::TileGenerator;
pub struct MyGenerator;
impl TileGenerator for MyGenerator {
fn tile_at(&self, tiles: &HashMap<IVec2, MapTile>, location: IVec2) -> MapTile {
// Your generation logic
}
}
Game assets are located in brain-engine-bin/assets/
directory at the workspace root.