2021-08-12 00:34:13 -06:00
|
|
|
use hypoloop::core::Loop;
|
2021-08-11 14:21:12 -06:00
|
|
|
|
2021-08-11 20:20:26 -06:00
|
|
|
// look into using closures for this
|
2021-08-11 13:52:44 -06:00
|
|
|
fn main() {
|
2021-08-11 20:20:26 -06:00
|
|
|
// create sim and configure it
|
2021-08-12 00:34:13 -06:00
|
|
|
let mut sim = Loop::new();
|
2021-08-11 20:20:26 -06:00
|
|
|
//sim.set_realtime(false);
|
2021-08-11 14:21:12 -06:00
|
|
|
|
2021-08-12 00:34:13 -06:00
|
|
|
// test variable
|
|
|
|
let mut x: f32 = 0.0;
|
2021-08-11 20:20:26 -06:00
|
|
|
|
2021-08-12 00:34:13 -06:00
|
|
|
// run the simulation using custom update logic
|
|
|
|
sim.run(|state| {
|
|
|
|
state.debug_tick();
|
|
|
|
|
|
|
|
x += 2.0 * state.get_timescale();
|
|
|
|
|
|
|
|
//println!("Delta time: {} | Timescale: {} | Sim time: {} | x: {}", state.get_delta_time(), state.get_timescale(), state.get_sim_time().as_millis(), x);
|
|
|
|
});
|
2021-08-11 20:20:26 -06:00
|
|
|
}
|