Fixed faulty timestep

This commit is contained in:
2021-11-09 12:18:33 -08:00
parent 560c04c89d
commit 4728c9be5d
2 changed files with 31 additions and 21 deletions

View File

@@ -6,6 +6,12 @@ fn main() {
// create a sim loop
let mut sim = Loop::new();
// set the loop update interval
sim.set_update_interval(40);
// set the loop's timescale
sim.get_state_mut().set_timescale(1.0);
// datastream
let mut x: i32 = 0;
@@ -16,12 +22,16 @@ fn main() {
// update logic goes here
if sim.is_awake() {
//sim.get_state().debug_time();
x += 1;
println!("x: {}", x);
//x += 1;
//println!("x: {}", x);
}
sim.get_state().debug_time();
// display logic goes here
// problem: the timestep is not what we want here. we need to get the elapsed time
//let timestep = sim.get_state().get_timestep();
//let x_interpolated: f32 = x as f32 + timestep;
//println!("x: {}", x_interpolated);
}
}