roast2d_internal 0.3.5

Roast2D internal crate
Documentation
#[cfg(not(target_arch = "wasm32"))]
use std::time::Instant;
#[cfg(target_arch = "wasm32")]
use web_time::Instant;

use crate::engine::Clock;

pub struct InstantClock {
    now: Instant,
}

impl Default for InstantClock {
    fn default() -> Self {
        Self {
            now: Instant::now(),
        }
    }
}

impl Clock for InstantClock {
    fn now(&mut self) -> f32 {
        self.now.elapsed().as_secs_f32()
    }
}