From 26b286af31bd72688f9159d60fa3bf4dd872c547 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 5 Aug 2024 16:23:11 -0700 Subject: [PATCH] wip --- src/physics_worker.rs | 7 +++++-- src/window.rs | 9 ++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/physics_worker.rs b/src/physics_worker.rs index 5e41e07..daee45b 100644 --- a/src/physics_worker.rs +++ b/src/physics_worker.rs @@ -217,6 +217,9 @@ impl MouseInterpolator<'_>{ )), }); } + pub const fn user_settings(&self)->&crate::settings::UserSettings{ + &self.user_settings + } } } @@ -226,7 +229,7 @@ pub fn new<'a>( user_settings:crate::settings::UserSettings, )->crate::compat_worker::QNWorker<'a,TimedInstruction>{ let physics=crate::physics::PhysicsContext::default(); - let mut interpolator=MouseInterpolator::new(physics,bot_worker); + let mut interpolator=MouseInterpolator::new(physics,bot_worker,user_settings); crate::compat_worker::QNWorker::new(move |ins:TimedInstruction|{ interpolator.handle_instruction(&ins); match ins.instruction{ @@ -235,7 +238,7 @@ pub fn new<'a>( graphics_worker.send(crate::graphics_worker::Instruction::Render(physics_output,time,mouse_pos)).unwrap(); }, Instruction::Resize(size)=>{ - graphics_worker.send(crate::graphics_worker::Instruction::Resize(size,user_settings)).unwrap(); + graphics_worker.send(crate::graphics_worker::Instruction::Resize(size,interpolator.user_settings().clone())).unwrap(); }, Instruction::ChangeMap(map)=>{ interpolator.change_map(ins.time,&map); diff --git a/src/window.rs b/src/window.rs index 633e2db..f05c7cf 100644 --- a/src/window.rs +++ b/src/window.rs @@ -15,7 +15,6 @@ struct WindowContext<'a>{ manual_mouse_lock:bool, mouse:strafesnet_common::mouse::MouseState,//std::sync::Arc> screen_size:glam::UVec2, - user_settings:crate::settings::UserSettings, window:&'a winit::window::Window, physics_thread:crate::compat_worker::QNWorker<'a, TimedInstruction>, } @@ -170,9 +169,6 @@ pub fn worker<'a>(window:&'a winit::window::Window,setup_context:crate::setup::S // WindowContextSetup::new let user_settings=crate::settings::read_user_settings(); - let mut physics=crate::physics::PhysicsContext::default(); - physics.load_user_settings(&user_settings); - let mut graphics=crate::graphics::GraphicsState::new(&setup_context.device,&setup_context.queue,&setup_context.config); graphics.load_user_settings(&user_settings); @@ -186,9 +182,8 @@ pub fn worker<'a>(window:&'a winit::window::Window,setup_context:crate::setup::S mouse:strafesnet_common::mouse::MouseState::default(), //make sure to update this!!!!! screen_size, - user_settings, window, - physics_thread:crate::physics_worker::new(physics,graphics_thread,bot_thread), + physics_thread:crate::physics_worker::new(graphics_thread,bot_thread,user_settings), }; //WindowContextSetup::into_worker @@ -207,7 +202,7 @@ pub fn worker<'a>(window:&'a winit::window::Window,setup_context:crate::setup::S window_context.physics_thread.send( TimedInstruction{ time:ins.time, - instruction:crate::physics_worker::Instruction::Resize(size,window_context.user_settings.clone()) + instruction:crate::physics_worker::Instruction::Resize(size) } ).unwrap(); }