main_loop

Crates.iomain_loop
lib.rsmain_loop
version0.3.3
sourcesrc
created_at2017-11-26 21:22:07.606996
updated_at2018-11-24 17:26:02.684489
descriptionmain loop for real time applications
homepagehttps://gitlab.com/nathanfaucett/rs-main_loop
repositoryhttps://gitlab.com/nathanfaucett/rs-main_loop.git
max_upload_size
id40660
size13,592
Nathan Faucett (nathanfaucett)

documentation

README

main_loop

main loop for real time applications

No Default features

main_loop = { version = "0.3", default-features = false }
extern crate main_loop;

use main_loop::ControlFlow;

fn main() {
    main_loop::run(|ms| {
        println!("{:?}ms since start", ms);
        ControlFlow::Continue
    });
}

glutin

main_loop = { version = "0.3" }
extern crate glutin;
extern crate main_loop;

use main_loop::ControlFlow;

fn main() {
    let mut events_loop = glutin::EventsLoop::new();
    let window = glutin::WindowBuilder::new()
        .with_title("Glutin")
        .with_dimensions(512, 512);
    let context = glutin::ContextBuilder::new();
    let _gl_window = glutin::GlWindow::new(window, context, &events_loop).unwrap();


    main_loop::glutin::run(&mut events_loop, |events, ms| {
        println!("{:?}ms since start", ms);

        for event in events {
            println!("{:?}", event);
        }

        ControlFlow::Continue
    });
}

winit

main_loop = { version = "0.3" }
extern crate main_loop;
extern crate winit;

use main_loop::ControlFlow;
use winit::{EventsLoop, Window};

fn main() {
    let mut events_loop = EventsLoop::new();
    let _window = Window::new(&events_loop).unwrap();

    main_loop::winit::run(&mut events_loop, |events, ms| {
        println!("{:?}ms since start", ms);

        for event in events {
            println!("{:?}", event);
        }

        ControlFlow::Continue
    });
}
Commit count: 21

cargo fmt