Major Refactor: separate project into multiple crates

This commit is contained in:
reo 2025-07-17 23:19:46 +03:00
parent f943e4c945
commit d0440f3da3
24 changed files with 209 additions and 2232 deletions

View file

@ -0,0 +1,4 @@
[package]
name = "raidillon_core"
version = "0.1.0"
edition = "2021"

View file

@ -0,0 +1,3 @@
pub mod time;
pub use time::Time;

View file

@ -0,0 +1,34 @@
use std::time::{Duration, Instant};
#[derive(Clone, Debug)]
pub struct Time {
last: Instant,
delta: Duration,
total: Duration,
}
impl Time {
pub fn new() -> Self {
let now = Instant::now();
Self {
last: now,
delta: Duration::ZERO,
total: Duration::ZERO,
}
}
pub fn tick(&mut self) {
let now = Instant::now();
self.delta = now - self.last;
self.total += self.delta;
self.last = now;
}
pub fn delta_seconds(&self) -> f32 {
self.delta.as_secs_f32()
}
pub fn total_seconds(&self) -> f32 {
self.total.as_secs_f32()
}
}