#![allow(unused)] pub mod backend; pub mod dummy; pub mod error; pub mod text; pub mod vulkan; use backend::RendererBackend; use text::TextSpan; pub struct Renderer<'a> { pub backend: Box, pub width: i32, pub height: i32, } impl<'a> Renderer<'a> { pub fn new(mut backend: B, width: i32, height: i32) -> Self where B: RendererBackend + 'a, { backend.init(width, height); Self { backend: Box::new(backend), width, height, } } pub fn clear(&mut self) { self.backend.clear(); } pub fn draw_text(&mut self, span: &TextSpan) { self.backend.draw_text(span); } pub fn present(&mut self) { self.backend.present(); } pub fn shutdown(&mut self) { self.backend.shutdown(); } }