#frame-rate #counter #hot #loops #cap #limiter #cold

frame_counter

simple frame counter and limiter

3 releases

0.1.2 Apr 2, 2021
0.1.1 Apr 2, 2021
0.1.0 Apr 2, 2021

#962 in Game dev

Download history 7/week @ 2024-02-15 11/week @ 2024-02-22 3/week @ 2024-02-29 3/week @ 2024-03-07 6/week @ 2024-03-14 33/week @ 2024-03-28 32/week @ 2024-04-04

65 downloads per month

Custom license

9KB
79 lines

frame_counter

Crates.io Docs.rs MIT licensed

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);
    }
}

No runtime deps