use {
crate::ToSignal,
bevy::reflect::{TypePath, TypeUuid},
oddio::{Frame, Frames},
std::{marker::PhantomData, sync::Arc},
};
#[derive(TypeUuid, TypePath, Default)]
#[uuid = "f391d20f-7654-403a-b7c9-3f3c7991138a"]
pub struct Cycle<T> {
_phantom: PhantomData<T>,
}
impl<T> Cycle<T> {
#[must_use]
pub fn new() -> Self {
Self {
_phantom: PhantomData,
}
}
}
pub struct Settings<T> {
frames: Arc<Frames<T>>,
}
impl<T> Settings<T> {
#[must_use]
pub fn new(frames: Arc<Frames<T>>) -> Self {
Self { frames }
}
}
impl<T: Send + Sync + Clone + Copy + Frame> ToSignal for Cycle<T> {
type Settings = Settings<T>;
type Signal = oddio::Cycle<T>;
fn to_signal(&self, settings: Self::Settings) -> Self::Signal {
oddio::Cycle::new(settings.frames)
}
}