frame_counter

Crates.ioframe_counter
lib.rsframe_counter
version0.1.2
sourcesrc
created_at2021-04-02 19:36:14.277999
updated_at2021-04-02 19:57:40.592606
descriptionsimple frame counter and limiter
homepage
repositoryhttps://github.com/ko1N/frame_counter
max_upload_size
id377855
size10,051
(ko1N)

documentation

https://docs.rs/frame_counter

README

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);
    }
}
Commit count: 7

cargo fmt