19 releases

Uses old Rust 2015

0.6.1 Jul 6, 2019
0.5.2 Nov 24, 2018
0.5.1 Jun 29, 2018
0.3.5 Feb 24, 2018
0.3.0 Nov 27, 2017

#26 in #specs


Used in 2 crates

MIT license

9KB
239 lines

specs_time

time resource for specs

extern crate specs;
extern crate specs_bundler;
extern crate specs_time;

use specs::{DispatcherBuilder, World};
use specs_bundler::Bundler;
use specs_time::{Time, TimeBundle};
use std::{thread, time};

fn main() {
    let mut world = World::empty();

    let mut dispatcher = Bundler::new(&mut world, DispatcherBuilder::new())
        .bundle(TimeBundle::<f64>::default())
        .unwrap()
        .build();

    for _ in 0..60 {
        dispatcher.dispatch(&world);
        thread::sleep(time::Duration::from_millis(16));
    }

    let time = world.fetch::<Time<f64>>();
    println!("{:?}", *time);
}

Dependencies

~7MB
~132K SLoC