main.rs 812 B

12345678910111213141516171819202122232425262728
  1. #[macro_use]
  2. extern crate specs_derive;
  3. pub mod components;
  4. pub mod consts;
  5. pub mod game;
  6. pub mod resources;
  7. pub mod sys;
  8. fn main() -> Result<(), ggez::error::GameError> {
  9. // Make a Context and an EventLoop.
  10. let (mut ctx, mut evloop) = ggez::ContextBuilder::new("game", "me")
  11. .add_resource_path({
  12. let base = std::env::var("CARGO_MANIFEST_DIR").unwrap();
  13. let mut path = std::path::PathBuf::from(base);
  14. path.push("assets");
  15. path
  16. })
  17. .window_mode(ggez::conf::WindowMode {
  18. width: consts::WINDOW_WIDTH,
  19. height: consts::WINDOW_HEIGHT,
  20. ..Default::default()
  21. })
  22. .build()?;
  23. let mut my_game = game::MyGame::setup(&mut ctx)?;
  24. ggez::event::run(&mut ctx, &mut evloop, &mut my_game)
  25. }