mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Move fps meter util
This commit is contained in:
parent
600a404516
commit
5cb2e93387
@ -1,4 +1,3 @@
|
||||
mod fps_meter;
|
||||
mod input;
|
||||
mod platform;
|
||||
|
||||
|
||||
@ -4,6 +4,17 @@ use log::info;
|
||||
|
||||
use crate::platform::Instant;
|
||||
|
||||
/// Measures the frames per second.
|
||||
///
|
||||
/// # Example
|
||||
/// ```rust
|
||||
/// use crate::util::FPSMeter;
|
||||
///
|
||||
/// let mut meter = FPSMeter::new();
|
||||
///
|
||||
/// // call the following the the render loop
|
||||
/// meter.update_and_print();
|
||||
/// ```
|
||||
pub struct FPSMeter {
|
||||
next_report: Instant,
|
||||
frame_count: u32,
|
||||
@ -1,11 +1,11 @@
|
||||
use crate::platform::Instant;
|
||||
use log::trace;
|
||||
|
||||
pub struct Measure {
|
||||
pub struct TimeMeasure {
|
||||
now: Instant,
|
||||
}
|
||||
|
||||
impl Measure {
|
||||
impl TimeMeasure {
|
||||
pub fn time() -> Self {
|
||||
Self {
|
||||
now: Instant::now(),
|
||||
@ -22,7 +22,7 @@ impl Measure {
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Measure {
|
||||
impl Drop for TimeMeasure {
|
||||
fn drop(&mut self) {
|
||||
self.breadcrumb("Drop");
|
||||
}
|
||||
|
||||
@ -1 +1,7 @@
|
||||
pub mod measure;
|
||||
//! Utils which are used internally
|
||||
|
||||
mod fps_meter;
|
||||
mod measure;
|
||||
|
||||
pub use fps_meter::FPSMeter;
|
||||
pub use measure::TimeMeasure;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user