Skip to content

Commit

Permalink
print out FPS in debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Hlusička committed Aug 31, 2016
1 parent a349365 commit 76bc8d4
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use std::collections::HashSet;
use std::time::Instant;
use std::time::Duration;
use std::marker::PhantomData;
use num::One;
use na;
use na::Cast;
use na::Point2;
use na::Vector2;
use glium::DisplayBuild;
Expand Down Expand Up @@ -102,6 +104,13 @@ impl<F: CustomFloat> Simulation<F> {
delta = now - self.last_updated_instant.unwrap();
}

if self.context.debugging {
let delta_millis: F = <F as One>::one()
/ Cast::from((delta * 1000).as_secs() as f64 / 1000.0);

println!("FPS: {}", delta_millis);
}

self.last_updated_instant = Some(now);
let result = self.context.update(self.facade.as_mut().unwrap(), self.debug);

Expand Down

0 comments on commit 76bc8d4

Please sign in to comment.