pub fn await_fps(&mut self, target_fps: u64, threshold: u64) {
        let ms_per_frame = 1000 / target_fps;
        let elapsed = self.instant.elapsed().as_millis() as u64;
        let dt = elapsed - self.previous_time;
        
        // This is actually the time per frame
        // println!("sleep dt: {}", dt); 

        if (dt < ms_per_frame) && (ms_per_frame - dt > threshold) {
            // println!("Sleeping for {} ms", ms_per_frame - dt - 1);
            std::thread::sleep(
                time::Duration::from_millis(ms_per_frame - dt - 1)
            );
        }
    }
/// Locks the thread until the `target_fps` is met based on the last call to `tick()`. 
///   
/// Does nothing if more time has elapsed since the last call to `tick()` than desired fps as ms per frame.
/// - `threshold` determines whether to skip sleeping if the desired time per frame is close to the time since last `tick()`
// NOTE: Sleep for one less ms since timing is not guarenteed to be exact.
Locks the thread until the `target_fps` is met based on the last call to `tick()`.
Does nothing if more time has elapsed since the last call to `tick()` than desired fps as ms per frame.
`threshold` determines whether to skip sleeping if the desired time per frame is close to the time since last `tick()`
NOTE: Sleep for one less ms since timing is not guarenteed to be exact.
Locks the thread until the ` target_fps ` is met based on the last call to ` tick () ` . Does nothing if more time has elapsed since the last call to ` tick () ` than desired fps as ms per frame . ` threshold ` determines whether to skip sleeping if the desired time per frame is close to the time since last ` tick () ` NOTE : Sleep for one less ms since timing is not guarenteed to be exact .
pub fn await_fps(&mut self, target_fps: u64, threshold: u64) {
        let ms_per_frame = 1000 / target_fps;
        let elapsed = self.instant.elapsed().as_millis() as u64;
        let dt = elapsed - self.previous_time;
        // This is actually the time per frame
        // println!("sleep dt: {}", dt); 
        if (dt < ms_per_frame) && (ms_per_frame - dt > threshold) {
            // println!("Sleeping for {} ms", ms_per_frame - dt - 1);
            std::thread::sleep(
                time::Duration::from_millis(ms_per_frame - dt - 1)
            );
        }
    }
pub fn await_fps ( & mut self , target_fps : u64 , threshold : u64 ) { let ms_per_frame = 1000 / target_fps ; let elapsed = self . instant . elapsed ( ) . as_millis ( ) as u64 ; let dt = elapsed - self . previous_time ; // This is actually the time per frame // println!("sleep dt: {}", dt);  if ( dt < ms_per_frame ) && ( ms_per_frame - dt > threshold ) { // println!("Sleeping for {} ms", ms_per_frame - dt - 1); std :: thread :: sleep ( time :: Duration :: from_millis ( ms_per_frame - dt - 1 ) ) ; } }
Locks the thread until the `target_fps` is met based on the last call to `tick()`.
Locks the thread until the ` target_fps ` is met based on the last call to ` tick () ` .
&mut self
target_fps
u64
threshold
u64
&mut self
target_fps
u64
threshold
u64