mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
remove vec allocation from plugin callback
This commit is contained in:
parent
828436745c
commit
672d81f353
5 changed files with 150 additions and 116 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue