feat(renderer): added scale_factor to the trait to allow checking for scale factors in the event loop

This commit is contained in:
lisk77 2025-10-26 02:32:50 +02:00
parent dd89d71565
commit 87f0233066
3 changed files with 32 additions and 7 deletions

View file

@ -1,12 +1,15 @@
use comet_colors::Color;
use std::sync::Arc;
use winit::dpi::PhysicalSize;
use winit::window::Window;
use comet_colors::Color;
pub trait Renderer: Sized + Send + Sync {
fn new(window: Arc<Window>, clear_color: Option<impl Color>) -> 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>;
}
fn new(window: Arc<Window>, clear_color: Option<impl Color>) -> Self;
fn size(&self) -> PhysicalSize<u32>;
fn resize(&mut self, new_size: winit::dpi::PhysicalSize<u32>);
fn scale_factor(&self) -> f64;
fn set_scale_factor(&mut self, scale_factor: f64);
fn update(&mut self) -> f32;
fn render(&mut self) -> Result<(), wgpu::SurfaceError>;
}