remove vec allocation from plugin callback

This commit is contained in:
🪞👃🪞 2024-07-06 21:03:36 +03:00
parent 828436745c
commit 672d81f353
5 changed files with 150 additions and 116 deletions

View file

@ -1,6 +1,7 @@
use crate::core::*;
use atomic_float::AtomicF64;
#[derive(Debug)]
/// Keeps track of global time units.
pub struct Timebase {
/// Frames per second
rate: AtomicF64,
@ -98,14 +99,17 @@ impl Timebase {
}
/// Defines frames per tick.
pub struct Ticks(pub f64);
impl Ticks {
/// Iterate over ticks between start and end.
pub fn between_frames (&self, start: usize, end: usize) -> TicksIterator {
TicksIterator(self.0, start, start, end)
}
}
/// Iterator that emits subsequent ticks within a range.
pub struct TicksIterator(f64, usize, usize, usize);
impl Iterator for TicksIterator {