Guest User

Untitled

a guest
Jan 16th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. mod particle;
  2. mod universe;
  3.  
  4. use crate::universe::Universe;
  5. use amethyst::{
  6. assets::{PrefabLoader, PrefabLoaderSystem, RonFormat},
  7. core::transform::TransformBundle,
  8. prelude::*,
  9. renderer::{DisplayConfig, DrawFlat, Pipeline, PosNormTex, RenderBundle, Stage},
  10. utils::{application_root_dir, scene::BasicScenePrefab},
  11. };
  12.  
  13. pub type MyPrefabData = BasicScenePrefab<Vec<PosNormTex>>;
  14.  
  15. fn main() -> amethyst::Result<()> {
  16. amethyst::start_logger(Default::default());
  17.  
  18. let app_root = application_root_dir();
  19.  
  20. let config_path = format!("{}/resources/display_config.ron", app_root);
  21. let config = DisplayConfig::load(&config_path);
  22.  
  23. let resources = format!("{}/resources", app_root);
  24.  
  25. let pipe = Pipeline::build().with_stage(
  26. Stage::with_backbuffer()
  27. .clear_target([0.00196, 0.23726, 0.21765, 1.0], 1.0)
  28. .with_pass(DrawFlat::<PosNormTex>::new()),
  29. );
  30.  
  31. let game_data = GameDataBuilder::default()
  32. .with(PrefabLoaderSystem::<MyPrefabData>::default(), "", &[])
  33. .with_bundle(RenderBundle::new(pipe, Some(config)))?
  34. .with_bundle(TransformBundle::new())?;
  35.  
  36. let mut game = Application::new(resources, Universe {}, game_data)?;
  37.  
  38. game.run();
  39.  
  40. Ok(())
  41. }
Add Comment
Please, Sign In to add comment