This commit is contained in:
Quaternions 2024-08-05 16:23:11 -07:00
parent ad78fd22be
commit 26b286af31
2 changed files with 7 additions and 9 deletions

View File

@ -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<Instruction>>{
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<Instruction>|{
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);

View File

@ -15,7 +15,6 @@ struct WindowContext<'a>{
manual_mouse_lock:bool,
mouse:strafesnet_common::mouse::MouseState,//std::sync::Arc<std::sync::Mutex<>>
screen_size:glam::UVec2,
user_settings:crate::settings::UserSettings,
window:&'a winit::window::Window,
physics_thread:crate::compat_worker::QNWorker<'a, TimedInstruction<crate::physics_worker::Instruction>>,
}
@ -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();
}