Crates.io | specs_time |
lib.rs | specs_time |
version | 0.6.1 |
source | src |
created_at | 2017-10-13 19:41:48.919201 |
updated_at | 2019-07-06 13:54:05.504875 |
description | time resource for specs |
homepage | https://gitlab.com/nathanfaucett/rs-specs_time |
repository | https://gitlab.com/nathanfaucett/rs-specs_time.git |
max_upload_size | |
id | 35534 |
size | 26,140 |
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);
}