main_game_loop 0.2.5

A game loop with event handling
Documentation

main_game_loop

dependency status

Example usage with some random Engine

fn run(mut engine: Engine) {
    let window = engine.create_window(WindowBuilder::new())unwrap();
    let mut update_loop = UpdateLoop::new(UpdateRate::PerSecond(60));

    loop {
        while let Some(event) = engine.poll() {
            // process events here
        }

        let delta = update_loop.update(|| {
            // process updates @ 60 / s here
        });

        // process drawing here
    }
}

fn main() {
    env_logger::init();
    Engine::new().run(run);
}