use super::*;

mod query; pub use query::*;
mod device; pub use device::Device;
mod vulkan; use vulkan::Vulkan as Renderer;
mod internal; use internal::Internal;

pub struct VideoManager {
    channel:Sender<Query>,
}

impl VideoManager {

}

impl Subsystem for VideoManager {
    fn start(supervisor:Option<Sender<Query>>) -> Result<Sender<Query>, Error>
    {
        if let Some(supervisor) = supervisor {
            let (tx, rx) = channel::bounded::<Query>(24);

            let sys_tx = tx.clone();
            std::thread::spawn(move || {
                Internal::thread(supervisor, sys_tx, rx);
            });

            Ok(tx)
        } else {
            Err(Error::new())
        }
    }
}

impl From<Sender<Query>> for VideoManager {
    fn from(channel:Sender<Query>) -> Self {
        Self { channel }
    }
}

/***

Context (physical device, window)

Viewport

***/
