gdritter repos wenaglia / master src / main.rs
master

Tree @master (Download .tar.gz)

main.rs @masterraw · history · blame

#[macro_use]
extern crate specs_derive;

pub mod components;
pub mod consts;
pub mod game;
pub mod resources;
pub mod sys;

fn main() -> Result<(), ggez::error::GameError> {
    // Make a Context and an EventLoop.
    let (mut ctx, mut evloop) = ggez::ContextBuilder::new("game", "me")
        .add_resource_path({
            let base = std::env::var("CARGO_MANIFEST_DIR").unwrap();
            let mut path = std::path::PathBuf::from(base);
            path.push("assets");
            path
        })
        .window_mode(ggez::conf::WindowMode {
            width: consts::WINDOW_WIDTH,
            height: consts::WINDOW_HEIGHT,
            ..Default::default()
        })
        .build()?;

    let mut my_game = game::MyGame::setup(&mut ctx)?;
    ggez::event::run(&mut ctx, &mut evloop, &mut my_game)
}