3 releases
0.1.2 | Apr 2, 2021 |
---|---|
0.1.1 | Apr 2, 2021 |
0.1.0 | Apr 2, 2021 |
#1146 in Game dev
9KB
79 lines
frame_counter
The frame_counter library provides a very simple to use framerate counter based around the rust time module.
Additionally the FrameCounter
can also be used to cap the framerate at a certain value either in a hot or cold loop.
Examples:
Counting the framerate:
use frame_counter::FrameCounter;
pub fn dummy_workload() {
std::thread::sleep(std::time::Duration::from_millis(10));
}
pub fn main() {
let mut frame_counter = FrameCounter::default();
loop {
frame_counter.tick();
dummy_workload();
println!("fps stats - {}", frame_counter);
}
}