mirror of
https://github.com/lisk77/comet.git
synced 2025-12-15 18:18:50 +00:00
feat: Added swappability of the renderer and added a Renderer trait to make custom renderers if needed. Also renamed Renderer2D component to Render2D because it is a "render component" and not a renderer (but also name to avoid name clashes)
This commit is contained in:
parent
29355335e6
commit
a3df3f4f17
5 changed files with 133 additions and 129 deletions
12
crates/comet_renderer/src/renderer.rs
Normal file
12
crates/comet_renderer/src/renderer.rs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
use std::sync::Arc;
|
||||
use winit::dpi::PhysicalSize;
|
||||
use winit::window::Window;
|
||||
use comet_colors::LinearRgba;
|
||||
|
||||
pub trait Renderer: Sized {
|
||||
async fn new(window: Arc<Window>, clear_color: Option<LinearRgba>) -> Self;
|
||||
fn size(&self) -> PhysicalSize<u32>;
|
||||
fn resize(&mut self, new_size: winit::dpi::PhysicalSize<u32>);
|
||||
fn update(&mut self) -> f32;
|
||||
fn render(&mut self) -> Result<(), wgpu::SurfaceError>;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue