-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(rrt): rrt environment example started
- Loading branch information
Showing
25 changed files
with
302 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,6 @@ | |
**/*.png | ||
!**/assets/**/* | ||
|
||
**/*rustc-ice* | ||
|
||
.bacon-locations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
//! example crate to take the environment config from the config file | ||
//! and generate the necessary environment and colliders for rrt to work | ||
use bevy::prelude::*; | ||
use gbpplanner_rs::{ | ||
asset_loader::AssetLoaderPlugin, | ||
cli, | ||
config::{read_config, Config, Environment, FormationGroup}, | ||
environment::EnvironmentPlugin, | ||
input::{camera::CameraInputPlugin, ChangingBinding, InputPlugin}, | ||
theme::ThemePlugin, | ||
}; | ||
|
||
fn main() -> anyhow::Result<()> { | ||
better_panic::debug_install(); | ||
|
||
let cli = cli::parse_arguments(); | ||
|
||
let (config, formation, environment): (Config, FormationGroup, Environment) = if cli.default { | ||
( | ||
Config::default(), | ||
FormationGroup::default(), | ||
Environment::default(), | ||
) | ||
} else { | ||
let config = read_config(cli.config.as_ref())?; | ||
if let Some(ref inner) = cli.config { | ||
println!( | ||
"successfully read config from: {}", | ||
inner.as_os_str().to_string_lossy() | ||
); | ||
} | ||
|
||
let formation = FormationGroup::from_file(&config.formation_group)?; | ||
println!( | ||
"successfully read formation config from: {}", | ||
config.formation_group | ||
); | ||
let environment = Environment::from_file(&config.environment)?; | ||
println!( | ||
"successfully read environment config from: {}", | ||
config.environment | ||
); | ||
|
||
(config, formation, environment) | ||
}; | ||
|
||
let mut app = App::new(); | ||
app.insert_resource(config) | ||
.insert_resource(formation) | ||
.insert_resource(environment) | ||
.init_resource::<ChangingBinding>() | ||
.add_plugins(( | ||
DefaultPlugins, | ||
AssetLoaderPlugin, | ||
CameraInputPlugin, | ||
EnvironmentPlugin, | ||
ThemePlugin, | ||
)) | ||
.run(); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![deny(missing_docs)] | ||
#![warn(missing_docs)] | ||
//! cli argument parser module | ||
use clap::Parser; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![deny(missing_docs)] | ||
#![warn(missing_docs)] | ||
|
||
use std::path::Path; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#![warn(missing_docs)] | ||
use std::ops::Range; | ||
|
||
use bevy::{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.