From 0bf253aa11bc606c03d9a422ee56d0e1a78f5a72 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 19 Oct 2023 19:29:40 -0700 Subject: [PATCH] remove graphics stuff from main --- src/framework.rs | 26 +++++--------------------- src/main.rs | 9 ++------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/src/framework.rs b/src/framework.rs index dd6ec0d..e4fa3f9 100644 --- a/src/framework.rs +++ b/src/framework.rs @@ -39,27 +39,11 @@ pub trait Example: 'static + Sized { fn required_limits() -> wgpu::Limits { wgpu::Limits::downlevel_webgl2_defaults() // These downlevel limits will allow the code to run on all possible hardware } - fn init( - config: &wgpu::SurfaceConfiguration, - adapter: &wgpu::Adapter, - device: &wgpu::Device, - queue: &wgpu::Queue, - ) -> Self; - fn resize( - &mut self, - config: &wgpu::SurfaceConfiguration, - device: &wgpu::Device, - queue: &wgpu::Queue, - ); - fn update(&mut self, window: &winit::window::Window, device: &wgpu::Device, queue: &wgpu::Queue, event: WindowEvent); + fn init() -> Self; + fn resize(&mut self); + fn update(&mut self, window: &winit::window::Window, event: WindowEvent); fn device_event(&mut self, window: &winit::window::Window, event: DeviceEvent); - fn render( - &mut self, - view: &wgpu::TextureView, - device: &wgpu::Device, - queue: &wgpu::Queue, - spawner: &Spawner, - ); + fn render(&self); } struct Setup { @@ -298,7 +282,7 @@ fn start( surface.configure(&device, &config); log::info!("Initializing the example..."); - let mut example = E::init(&config, &adapter, &device, &queue); + let mut example=E::init(); log::info!("Entering render loop..."); event_loop.run(move |event, _, control_flow| { diff --git a/src/main.rs b/src/main.rs index 707ebf9..69baaa0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -93,12 +93,7 @@ impl framework::Example for GlobalState { fn required_limits() -> wgpu::Limits { wgpu::Limits::default() //framework.rs was using goofy limits that caused me a multi-day headache } - fn init( - config: &wgpu::SurfaceConfiguration, - _adapter: &wgpu::Adapter, - device: &wgpu::Device, - queue: &wgpu::Queue, - ) -> Self { + fn init() -> Self { //wee let user_settings=settings::read_user_settings(); let mut indexed_models = Vec::new(); @@ -190,7 +185,7 @@ impl framework::Example for GlobalState { } #[allow(clippy::single_match)] - fn update(&mut self, window: &winit::window::Window, device: &wgpu::Device, queue: &wgpu::Queue, event: winit::event::WindowEvent) { + fn update(&mut self, window: &winit::window::Window, event: winit::event::WindowEvent) { let time=integer::Time::from_nanos(self.start_time.elapsed().as_nanos() as i64); match event { winit::event::WindowEvent::DroppedFile(path)=>{