main.rs 828 B

123456789101112131415161718192021222324252627282930
  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. pub mod types;
  9. fn main() -> Result<(), ggez::error::GameError> {
  10. // Make a Context and an EventLoop.
  11. let (mut ctx, mut evloop) = ggez::ContextBuilder::new("game", "me")
  12. .add_resource_path({
  13. let base = std::env::var("CARGO_MANIFEST_DIR").unwrap();
  14. let mut path = std::path::PathBuf::from(base);
  15. path.push("assets");
  16. path
  17. })
  18. .window_mode(ggez::conf::WindowMode {
  19. width: consts::WINDOW_WIDTH,
  20. height: consts::WINDOW_HEIGHT,
  21. ..Default::default()
  22. })
  23. .build()?;
  24. let mut my_game = game::MyGame::setup(&mut ctx)?;
  25. ggez::event::run(&mut ctx, &mut evloop, &mut my_game)
  26. }